且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

GridView项目模板中的div

更新时间:2023-09-18 20:05:22

给出div和id并运行runat ="server",然后使用rowdatabound事件

Give your div and id and runat="server" then use the rowdatabound event

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx

然后,您需要根据ID在每一行中找到div并进行所需的任何更改

You'll then need to find your div within each row based on the id and make whatever changes you need

哦,别忘了在rowdatabound事件中使用它,否则您将抢到页眉,页脚等,而无法在其中找到控件

Oh and don't forget to use this within your rowdatabound event or you'll grab headers, footers, etc and not be able to find your control in there

if(e.Row.RowType == DataControlRowType.DataRow)