WebGoober
asked on
Write a Javascript Function that Unchecks a Radio Button
How would I write a Javascript function that can be executed from within another Javascript function so that the original Javascript function unchecks a radio button ("Yes" or "No" option) from a RadioButtonList control (if one is checked)?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Alas, my experience with code behinds is very limited.
Are you receiving any errors or does it just not fire?
Are you receiving any errors or does it just not fire?
You need to run the controls he sampled and see how they render on the page @nap0leon then you can see how the name attributes are being skewed (sp) by the use of a masterpage.
Also @WebGoober an alternate to the way I had you set that up yesterday can be had by changing things around like this:
Also @WebGoober an alternate to the way I had you set that up yesterday can be had by changing things around like this:
function GetQuestionValue(showw)
{
//debugger;
var showdiv = document.getElementById(showw);
var radio = document.getElementsByName('<%=radQuestion.UniqueID %>');
//etc
radSubQuestion.Attributes.Add("onClick", string.Format("GetQuestionValue('{0}');", showdiv3.ClientID));
ASKER
Excellent!!! Thank you "nap0leon" for putting me on the right track in the first place and thank you "ddayx10" for getting this to work with a MasterPage template. Thank you... !!!!
ASKER
Open in new window
And I also have the following code in the Page_Load event:
Open in new window
So, basically, when I click on "Yes" for the first question, then the second question should display. Then, I can click on "Yes" for the second question and a input area displays. Now, when I reclick on the "Yes" option for the first question again, then your javascript kicks in and unchecks the second question altogether.
All of which works great within a single .aspx page; however, as soon as I copy it within my project that uses a MasterPage, then your code stops working.
Do you know what's causing this to stop working and how would I fix this?