Change CSS class of an element on runtime
asp.net, css
Solution
Really simple, just put a serverside tag:
<asp:Repeater ID="yourRepeater" runat="server">
<ItemTemplate>
....
<tr class='<%# Convert.ToBoolean(Eval("Locked")) ? "class1" : "class2" %>'>
....
</tr>
....
</ItemTemplate>
</asp:Repeater>
UPDATE: Thanks Kobi, i've missed Convert.ToBoolean() :)
Problem
Inside a repeater's ItemTemplate there is a: ``` <tr class="class1"> </tr> ``` I want this class to be changed to "class2" according to a valu that is bounded to this repeater, Eval("Locked"). If locked==true class="class1" else class="class2", how can I do it in simple way? (in code behind it's to complex)