I have some radiobuttons which I grouped them as set1..and another set of radiobuttons which I grouped as set2 which are disabled by default.When I click a radiobutton in set1 all the radiobuttons in set2 should be enabled and when I uncheck, all the radiobuttons should again become disabled.
How can this be done..plzz reply.

Recommended Answers

All 3 Replies

You can use if statement using ur radio button groups which are, in ur case set1 and set2, and inside them have statements like

document.Formname.NameOfTheRAD.selected="False" or "true"

And another thing you may post ur code so that we can be aware of what we are trying to achieve right??

SET1 <asp:RadioButton ID="rdintrvl" runat="server" Text="Interval" GroupName="set1" /> SET2

<asp:RadioButton ID="rddays" Text="Days" GroupName="set2" runat="server" Enabled="False"/>
<asp:RadioButton GroupName="set2"  ID="rdweeks" Text="Weeks" runat="server" Enabled="False"/>
<asp:RadioButton GroupName="set2"  ID="rdmonths" Text="Months" runat="server" Enabled="False"/>

in the page load rdintrvl.Attributes.Add("onclick", "enable();"); javascript function is

function enable()
     document.getElementById('<%=rddays.ClientID%>').disabled = false;
      document.getElementById('<%=rdweeks.ClientID%>').disabled = false;
       document.getElementById('<%=rdmonths.ClientID%>').disabled = false;

So its not really a Javascript but VBscript not that I know but according to my understanding I think you need to use VBScript or C# when dealing with ASP.net and Im not really equiped about VBscript

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.