【问题标题】:Adding an EditIndex to a Panel in Gridview Edit: can't set because the property doesn't already exist将 EditIndex 添加到 Gridview 中的面板编辑:无法设置,因为该属性尚不存在
【发布时间】:2016-01-23 06:37:46
【问题描述】:

错误:

“System.Web.UI.WebControls.Panel”不包含定义 'EditIndex' 并且没有扩展方法 'EditIndex' 接受第一个 可以找到“System.Web.UI.WebControls.Panel”类型的参数(是 您缺少 using 指令或程序集引用?)

我的代码:

protected void OnRowEditing(object sender, GridViewEditEventArgs e)
    {
        pnlGrid.EditIndex = e.NewEditIndex;
        this.DataBind();
    }

【问题讨论】:

  • 是的,如何解决这个问题?请推荐我
  • 您无法设置不存在的属性。它不存在。这就是错误所说的。要删除错误,请删除该行代码。
  • 那么如何使用面板编辑网格..??
  • 我的 HTML 代码是:

标签: c# asp.net gridview web-controls


【解决方案1】:

我认为您已将 Panel 引用而不是 GridView 引用。

[编辑]

例子:

<asp:GridView id="theGrid" runat="server" Visible="true" OnRowEditing="OnRowEditing" OnRowDeleting ="delete" OnRowUpdating = "Update" />

OnRowEditing 访问网格:

theGrid.EditIndex = e.NewEditIndex;

因此,您访问的是 GridView,而不是“静态”控件的 Panel。

【讨论】:

  • 我改为面板参考..但它显示同样的错误!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-03
  • 2010-09-27
  • 1970-01-01
  • 1970-01-01
  • 2012-06-06
相关资源
最近更新 更多