GridView、DataGrid使用DataBound事件前提

1.GridView

if (e.Row.RowType == DataControlRowType.DataRow)
{
    //...
}

2.DataGrid

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
    //...
}


你可能感兴趣的:(.NET,repeater,经验总结)