views:

174

answers:

1

Hi!

I have two radio buttons:

however, altough they have the same group name and I set one of them "checked" when I load my page they both look unchecked.

I even tried to set them on the code behind but still the check is not reflected to UI.

What do I do wrong?

Thanks

A: 

If the code you posted:

<asp:RadioButton ID="chbYesToOpen" runat="server" GroupName="ChangeToOpen" Text="Yes" Checked="false" />
<asp:RadioButton ID="chbNoToOpen" runat="server" GroupName="ChangeToOpen" Text="No" Checked="true" />

Is the code you are ustrying the following?:

chbYesToOpen.Checked = true;

Well I think this is the problem because you can't have 2 of them set as true. So try clearing the one that is set to true first and then setting the one you wanted checked after:

chbNoToOpen.Checked = false;
chbYesToOpen.Checked = true;

Or make sure in your markup, they are both set to Checked="false" by default and you should be ok to just set one to false.

Edit: I just tested your exact scenario and was able to recreate it and the solution I mentioned will fix your issue.

Kelsey
@burak ozdogan just following up, did you ever get this figured out?
Kelsey