I am using asp: Repeater control on my .aspx page, which is similar to:
<ol>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<li>
<%# Container.DataItem %>
</li>
</ItemTemplate>
</asp:Repeater>
</ol>
Note. In the combination lock, I associate a common data list with the Repeater1 control
I'm struggling to figure out how I can trap the values of Container.DataItem, and then, depending on the value, change the tag style attribute [li style = "myStyle"].
I am looking for an inline solution, so the pseudocode will look something like this:
<ol>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<% if(Container.DataItem == "some value")
{
<li style="style1">
<%# Container.DataItem %>
</li>
}
else
{
<li style="style2">
<%# Container.DataItem %>
</li>
}
%>
</ItemTemplate>
</asp:Repeater>
</ol>
Is there a built-in way to execute the above psuedo code example? If so, how?
source
share