Monday, July 20, 2009

An item disappears from radio button group

I have a radio button group with 4 choices, and I need to add another one. So i went to the RBG's properties and clicked on "Collection" and added
the new choice. I then built and debugged it, and noticed that the choice was NOT there!

So I looked in the behind code (ASP.NET markup) and noticed that the choice was not actually put in the list, but it was appearing in Design Mode.

Whats up with that? Well I couldn't find any explanation for why it happens but all you need to do to fix it is manually add the new item into the RBG:
like this

<asp:RadioButtonList ID="Choices" runat="server">
<asp:ListItem Value="OldChoice">Old Choice</asp:ListItem>
<asp:ListItem Value="NewChoice">New Choice</asp:ListItem>
</asp:RadioButtonList>

No comments:

Post a Comment

There was an error in this gadget