:
proctected sub gridview.DataBound(Byval sender as object, byval e assystemEventArgs) handles gridview.databound
{
}
如何在DATAGRID中使用DataBound?
答案 0 :(得分:0)
您可以尝试使用基于OnItemDataBound
<asp:DataGrid
id="ItemsGrid"
runat="server"
OnItemDataBound="Item_Bound"
.../>
//Code behind
void Item_Bound(Object sender, DataGridItemEventArgs e)
{
Label1.Text = Label1.Text + " " + e.Item.ItemIndex;
}
答案 1 :(得分:0)
说实话,你的问题目前没有多大意义。但是如果你想处理GridView的DataBound
事件(而不是RowDataBound
事件):
Protected Sub Gridview1_DataBound(sender As Object, e As System.EventArgs) Handles Gridview1.DataBound
Dim grid = DirectCast(sender, GridView)
Dim dataSource As Object = grid.DataSource
For Each row As GridViewRow In grid.Rows
' do something, looping all rows in the grid with RowType=DataRow '
Next row
End Sub