Here’s what I have (working):
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="Id" DataField="Id" SortExpression="Id">
</asp:BoundField>
<asp:BoundField HeaderText="Name" DataField="Name" SortExpression="Name">
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<% $Resources: Resource, strYes %>' />
<br />
<asp:Label ID="Label2" runat="server" Text='<%# Equals("name1",Eval("Name")) %>' />
<br />
<asp:Label ID="Label3" runat="server" Text='<%# Eval("Name") %>' />
<br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
What I wanted is something like (not working):
<asp:Label ID="Label4" runat="server" Text='<% (Equals("a",Eval("Name"))) $Resources: Resource, strYes : $Resources: Resource, strNo %>' />
but which I haven’t found out how to make it work! (So, depending on a previous column’s value, show one or the other Resource item).
Any suggestions to correct this? Thanks!
I think the easiest way is to use the return value of a function as text for your label:
And then in the .cs file