سؤال

I have an .aspx page that works as a PopUp. Sometimes, one RadioButtonList on this PopUp must be enabled, sometimes not. Here is the control :

<acc:RadiobuttonList ID="RadioButton1" runat="server" Font-Bold="true">
  <asp:ListItem Text="Yes" Value="1" />
  <asp:ListItem Text="No" Value="0" />
</acc:RadiobuttonList>

I tried two ways but none worked (even updating the UpdatePanel):

  • RadioButton1.Attributes.Add( "disabled", "disabled" );
  • RadioButton1.Enabled = false;

Only the RadioButtonList is having this behavior (there is another's controls in the page).

What is wrong?

Obs: I noticed that the 'SupportsDisabledAttribute' property of the control is 'false'. This can be influencing in the problem?

هل كانت مفيدة؟

المحلول

The following works fine

RadioButton1.Enabled = false;
RadioButton1.Items[0].Enabled = false;

May I know why is the namespace as acc and not asp

نصائح أخرى

Try RadioButton1.Items(0).Enabled = False... 0 being the index of the button to disable

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top