Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
That is correct. However, why do you need this id? If you want to get a reference to the item, you could always use the FindByValue method.is the ClientID of a radiobutton in a RadioButtonList always the Client ID of the the RadioButtonList + "_" + the RadioButtons index?
...
sScript += "if (document.getElementById(\"" + myRadioButtonList.ClientID + "_0\").checked)\n";
sScript += "{\n";
sScript += " alert('Please select a virus you would like on your computer!');\n";
sScript += " return false;\n";
sScript += "}\n";
sScript += "else\n";
sScript += "{\n";
sScript += " return true;\n";
sScript += "{\n";
myButton.Attributes.Add("onclick", sScript);
...
...
document.getElementById("<%=GetClientID(myButton, -1)%>".onclick = myButton_onclick;
...
function myButton_onclick()
{
if (document.getElementById("<%=GetClientID(myRadioButtonList, 0)%>").checked)
{
alert('Please select a virus you would like on your computer!');
return false;
}
else
{
return true;
}
}
protected string GetClientID(Control myControl, Int16 iRadioButtonIndex)
{
if (iRadioButtonIndex == -1)
return myControl.ClientID;
else
return myControl.ClientID + "_" + iRadioButtonIndex;
}