Asp.net 网格视图

发布于 2024-08-26 10:27:43 字数 111 浏览 3 评论 0原文

我无法在 gridview 中编辑详细信息。 当我单击“编辑”链接(命令字段)时,会触发行编辑事件,但是当我单击“更新”链接时,会再次触发行编辑事件,并且根本不会触发更新事件。

有什么建议吗?

I am nt able to edit the details in gridview.
When i click on Edit link(Command Field), row editing event is fired but when i click on update link , row editing event is fired again and update event is not getting fired at all.

Any suggestions ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

病女 2024-09-02 10:27:43

示例代码:
也许您应该尝试使用调试器并检查。
这里我给大家举了一个例子。

  protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {

        // Retrieve the row being edited.
        int index = GridView1.EditIndex;
        GridViewRow row = GridView1.Rows[index];
        TextBox t1 = row.FindControl("TextBox1") as TextBox;
        TextBox t2 = row.FindControl("TextBox2") as TextBox;
        string t3 = GridView1.DataKeys[e.RowIndex].Value.ToString();

        lblMsg.Text = "Updated record " + t1.Text + "," + t2.Text + "Value From Bound Field" + t3;
    }

Sample Code:
May be you should try using debugger and check.
Here i have given an example for you.

  protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {

        // Retrieve the row being edited.
        int index = GridView1.EditIndex;
        GridViewRow row = GridView1.Rows[index];
        TextBox t1 = row.FindControl("TextBox1") as TextBox;
        TextBox t2 = row.FindControl("TextBox2") as TextBox;
        string t3 = GridView1.DataKeys[e.RowIndex].Value.ToString();

        lblMsg.Text = "Updated record " + t1.Text + "," + t2.Text + "Value From Bound Field" + t3;
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文