jvancojr
asked on
Accessing/Setting Text inside a Label Control on an ASP.net Page (C#)
Good Afternoon,
I have been racking my brain on how to access/set the text inside a ASP.NET Label Control with client side javascript.
...And yes i have search this site for answers (for about 2 hours)
I have tried mutliple answers posted here and the closest I can get is 'undefined' to appear in the popup alert i have been using to test the response .
I am looking to grab the results of HTML radiobutton generated dynamically (works like a dream) and store the value a Label Control.
I am also trying to access the text in the lblNumberOfUsers control to let the function check more than one set of radio buttons.
Help...pulling what hair i have left out...lol
I have been racking my brain on how to access/set the text inside a ASP.NET Label Control with client side javascript.
...And yes i have search this site for answers (for about 2 hours)
I have tried mutliple answers posted here and the closest I can get is 'undefined' to appear in the popup alert i have been using to test the response .
I am looking to grab the results of HTML radiobutton generated dynamically (works like a dream) and store the value a Label Control.
I am also trying to access the text in the lblNumberOfUsers control to let the function check more than one set of radio buttons.
Help...pulling what hair i have left out...lol
function getCheckedValue(objName) {
//var numberOfGuest = document.getElementById('lblNumberOfUsers').text;
var numberOfGuest = document.getElementsByName('lblNumberOfUsers').innerHTML;
//var numberOfGuest = document.getElementById('lblNumberOfUsers').innerHTML;
alert(numberOfGuest);
var radioObj = document.getElementsByName(objName);
if (!radioObj)
return "";
var radioLength = radioObj.length;
if (radioLength == undefined)
if (radioObj.checked)
return radioObj.value;
else
return "";
for (var i = 0; i < radioLength; i++) {
if (radioObj[i].checked) {
//return radioObj[i].value;
alert(radioObj[i].value);
}
}
return "";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you have to capitalize the last 'd'. The property is ClientID. The error indicates you spelled the property as ClientId.
ASKER
I went another direction on this page to get around this issue.
Thanks all for your time
Thanks all for your time
ASKER
Error 1 'System.Web.UI.WebControls