In my form I have some TextBoxes. Once the value of TextBox is changed then corresponding RadioButton will be selected. But I want to prevent users from changing the value of RadioButton.
I tried disabling like this.
optA.Attributes.Add("disabled", "disabled");
But this script greys out the radiobutton which is not looking good. Is there any script to prevent users from clicking/changing the selected value of radiobutton?
Small example is
totalval=document.getElementById('txt1').value+document.getElementById('txt2').value
if (totalval>101)
document.getElementById('optA1').checked=true;
else if(totalval<100)
document.getElementById('optA2').checked=true;
This is what I want. So the users should not change the value of radiobuttons (optA1,optA2)
if am using
optA1.Attributes.Add("disabled", "disabled");
I couldnt get the value of optA1 at server side.
My aspx code is
<asp:RadioButton ID="optA1" GroupName="optAchieve" runat="server" Text="30" value="30" onclick="indicateColor()" />
<asp:RadioButton ID="optA2" GroupName="optAchieve" runat="server" Text="20" value="20" onclick="indicateColor()" />
You have to right javascript on radio button click , no matter what the radio option is selected always select the default option from javascript.