Getting the values of checkbox(es) checked in a checkboxlist

R

rishabhshrivastava

Hi All,
I am using CallBack feature in ASP.NET 2.0 and I am running into a
problem with checkboxlist control.

I have to find out which checkboxes are checked and get their values at
client-side(using JavaScript) but always I get a value
"undefined"....this code works for all other controls except
checkboxlist and radiobuttonlist controls. I am pasting my code below
Please let me know wht am i doing wrong.

At Server Side:-
chkBoxList.Attributes.Add("onclick", "UseCallBack('" &
chkBoxList.UniqueID & "');")

At ClientSide:-
function UseCallBack(cntrlName)
{
var cntrlID = cntrlName.split("$") ;
var cntrlValue = listValues(cntrlName);
var cntrlNameValue = cntrlID + '~' + cntrlValue;
GetCallBack(cntrlNameValue, "");

}

function listValues(objectName)
{
var list = null;
for (var i=0; i<objectName.length;i++){
if (document.getElementById(objectName).checked)
{
list += objectName.value + ',';
}
}
return list;
}

After the Values are determined I am grabbing the values on
ServerSide's RaiseCallBack Event method.


Please Help!!!!

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top