更新asp.net网格视图

时间:2012-06-11 15:25:35

标签: c# asp.net

我正在使用asp.net网格视图。

我调用了一些sql-server存储过程和

将它附加到gridView:

                    gvResults.DataSource = dr;
                    gvResults.DataBind();

我想让一个特定的列可编辑。

如何将更新sp附加到视图?

2 个答案:

答案 0 :(得分:0)

为gridview尝试Rowdatabound的处理程序:

      protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{       
    try
    {
        HyperLink hlControl = new HyperLink();
        hlControl.Text = "Info";
        hlControl.NavigateUrl = e.Row.Cells[3].Text;
        e.Row.Cells[3].Controls.Add(hlControl);
    }
    catch
    {
    }
}

我写这个是为了更改特定列中数据源的响应以更改为超链接控件,您可以使用该列执行任何操作。

答案 1 :(得分:0)