对于GridView中的每一行,我都有一个HyperLink,我需要为每个行生成不同的ID。使用Eval无法正常工作:
<asp:GridView
ID="ResultTableGvw"
runat="server"
AutoGenerateColumns="false"
OnRowDataBound="ResultTableGvw_RowDataBound">
<Columns>
<asp:BoundField ReadOnly="true" HeaderText="ID" DataField="id" />
<asp:BoundField ReadOnly="true" HeaderText="accountId" DataField="externalId" />
<asp:BoundField ReadOnly="true" HeaderText="tydeId" DataField="typeId" />
<asp:BoundField ReadOnly="true" HeaderText="Estado" DataField="statusId" />
<asp:BoundField ReadOnly="true" HeaderText="Timestamp do Pedido" DataField="timestampRequest" />
<asp:TemplateField HeaderText="Operação" ItemStyle-Wrap="false">
<ItemTemplate>
<asp:HyperLink
ID='<%# DataBinder.Eval( Container.DataItem, "Id", "OperationManagementHl{0}") %>'
runat="server"
Text="">
</asp:HyperLink>
</ItemTemplate>
<ItemStyle Wrap="False"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
有任何解决这个问题的建议吗?
错误是:The ID property of a control can only be set using the ID attribute in the tag and a simple value. Example: <asp:Button runat="server" id="Button1" />
答案 0 :(得分:0)
尝试使用此模式,它适用于我,
<asp:Label ID="lblNames" runat="server" Text='<%# Eval("Names") %>' Height ="60px" Width ="90%" CssClass="LabelDesign" />