I am having RadioButtonList as rbQ1,rbQ2,rbQ3 like this upto rbQ13.
Now I would like to loop through this radiobuttons to get the selected value of these radiobuttons.
I tried
Dim myControl1 As Control = FindControl("rbQ1")
Response.Write("<script type=""text/javascript"">alert(" & myControl1.selecteditem.value & ");</script")
Which is not working and showing the below error.
Error 16 ‘selecteditem’ is not a member of ‘System.Web.UI.Control’
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You need to cast it as a RadioButton. Control is a generic object representing the basic properties of all types of controls – and clearly not all of them have selected items.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0