GridView.RowDataBound、 Repeater.ItemDataBound 绑定时加入的判断语句

GridView.RowDataBound 加入 

e.Row.RowType == DataControlRowType.DataRow

详见:http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.gridview.rowdatabound%28v=VS.80%29.aspx

 

Repeater.ItemDataBound  加入

e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem

详见:http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.repeater.itemdatabound(VS.80).aspx

你可能感兴趣的:(GridView)