Sunday, March 1, 2009

Javascript:Asp.net Radiobuttonlist

Pass the clientID of the radiobutton list and check is it is selected or not.

//Check for selected radio button
function IsRadioSelected(rbClientID)
{

var inputArr = rbClientID.getElementsByTagName("INPUT");
var notselected=0;
for(var count=0;count < inputArr.length ;count++)
{

if(inputArr[count].type =='radio' && inputArr[count].checked==false)
{
notselected++;
}
}
return notselected;
}