0
我有一个ASP.NET的GridView如下...如何动态填充柱的ID在绑定ASP.NET GridView的
<asp:GridView ID="grdUserDecisions" runat="server" CssClass="Grid"
OnPageIndexChanging="grdUserDecisions_PageIndexChanging"
OnSorting="grdUserDecisions_Sorting">
<HeaderStyle CssClass="GridHeader"/>
<AlternatingRowStyle CssClass="GridAltItem"/>
<RowStyle CssClass="GridItem"/>
<PagerStyle CssClass="GridPager"/>
<Columns>
<%-- I don't want a link --%>
<asp:HyperLinkField
DataNavigateUrlFields="Name"
DataNavigateUrlFormatString="/default.aspx?id={0}"
DataTextField="Name" HeaderText="Name" />
<%-- I want the id value to be set in the DOM --%>
<asp:ButtonField ID='<%# Eval("Name") %>' DataField="Name" />
</Columns>
</asp:GridView>
是否有可能用一个ID值添加绑定列在请动态填充的DOM?
此行不起作用,因为没有ID属性。是否有不同的列类型可供使用?
<asp:ButtonField ID='<%# Eval("Name") %>' DataField="Name" />
在此先感谢。
使用'TemplateField' – mshsayem 2013-05-05 08:27:18