get value of dynamiclly created radiobuttonlist
Posted
by Mark
on Stack Overflow
See other posts from Stack Overflow
or by Mark
Published on 2010-05-24T11:58:01Z
Indexed on
2010/05/24
12:01 UTC
Read the original article
Hit count: 298
Hi All,
I'm trying to get the value of a dynamically created radiobuttonlist via javascript to call a pagemethod.
This is how I'm creating the rbl:
rbl.Attributes["onclick"] = "javascript:preview('" + rbl.ID + "','" + rbl.ClientID + "');";
And this is the javascript:
function preview(controlid, clientid)
{
var radio = document.getElementsByName(clientid);
var answer = "k";
for (var ii = 0; ii < radio.length; ii++)
{
if (radio[ii].checked)
answer = radio[ii].value;
}
PageMethods.SaveAnswer(controlid, answer);
}
The problem however is that I want to get the groupname of the radiobuttionlist so I can use getElementsByName, but i have no luck so far.
Kind regards, Mark
© Stack Overflow or respective owner