Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将 ID 设置为TabelRows生成者DataGrid/DataList?我想自己为DataList.
TabelRows
DataGrid/DataList
DataList
ItemDataBound在您的控件上附加事件处理程序:
ItemDataBound
<asp:DataGrid OnItemDataBound="myGrid_ItemDataBound" ...>
像这样声明处理程序方法:
protected void myGrid_ItemDataBound(object sender, DataGridItemEventArgs e) { e.Item.Attributes.Add("id", "some_id"); }