1

我有一个关于将新行添加到绑定到 RowDataBound 事件中的网格视图的数据表的问题。你知道我该怎么做吗?

4

1 回答 1

0

我会在 gridview 上使用 OnDataBound 事件。这样,在您的 rowdatabound 完成并且您的网格是数据绑定之后,将引发此事件。

<asp:gridview id="Gridview1" runat="server" ondatabound="Gridview_DataBound" 
...
</asp:gridview>

private void GridView_DataBound(EventArgs e)
{

if(e.Row.RowType == DataControlRowType.DataRow)
{
  //add row to here

}
}
于 2014-05-21T23:45:59.390 回答