C# ASP.NET使用Eval函数生成ID
对于GridView中的每一行,我都有一个超链接,我需要为每一行生成不同的ID。使用Eval无法正常工作:C# ASP.NET使用Eval函数生成ID,c#,asp.net,gridview,hyperlink,eval,C#,Asp.net,Gridview,Hyperlink,Eval,对于GridView中的每一行,我都有一个超链接,我需要为每一行生成不同的ID。使用Eval无法正常工作: <asp:GridView ID="ResultTableGvw" runat="server" AutoGenerateColumns="false" OnRowDataBound="ResultTableGvw_RowDataBound">
<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>
有什么解决这个问题的建议吗
错误是:
只能使用标记中的ID属性和简单值设置控件的ID属性。示例:
尝试使用此模式,它对我有效
<asp:Label ID="lblNames" runat="server" Text='<%# Eval("Names") %>' Height ="60px" Width ="90%" CssClass="LabelDesign" />
如果您能分享您所说的“工作不正常”的意思,这会有所帮助。发生了什么?哦,对不起,错误是:只能使用标记中的ID属性和简单值设置控件的ID属性。例子: