Reputation: 8624
I have the following code, I'm trying to disable the radio button when the condition is true. However when I add in the <%# Eval("category_id").ToString().Equals("5") ? "disabled" : "" %>
statement I'm getting the The server tag is not well formed
error.
I'm not sure what is wrong with my code. If I removed the Code snippet outside of the radio button tag the word disabled
displays as text on the screen, but as soon as I move it in the radio button tag I get the error.
<asp:RadioButton
ID="Status_C"
runat="server"
Text="C"
GroupName="Status"
Style="color: green;"
<%# Eval("category_id").ToString().Equals("5") ? "disabled" : "" %>
/>
Upvotes: 0
Views: 229
Reputation: 3662
<asp:RadioButton
ID="Status_C"
runat="server"
Text="C"
GroupName="Status"
Style="color: green;"
Enabled='<%# !(Eval("category_id").ToString().Equals("5")) %>'
/>
Upvotes: 1