Click here to Skip to main content
15,886,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all
i want to get the value of this id...

JavaScript
var val='categoryName_'+value2;

  var value1=document.getElementById('categoryName_'+value2).value;
Posted
Updated 29-Dec-12 1:13am
v2
Comments
Jibesh 29-Dec-12 7:29am    
what error you are getting ?
Akinmade Bond 29-Dec-12 9:04am    
What is stopping you from getting it?
Sandeep Mewara 29-Dec-12 12:52pm    
And the issue is?
Suresh Dasari's 30-Dec-12 9:12am    
what is the control element for this id 'categoryName_'+value2,
check the id of the control in browser view source.
AshishChaudha 31-Dec-12 6:07am    
what control you are using???

it gives result
C#
var val='categoryName_'+value2;

  var value1=document.getElementById('categoryName_'+value2).value;

please give what is your error or problem.....
 
Share this answer
 
better you use pass temp variable To get the value.


var val='categoryName_' + value2;

var value1=document.getElementById(val);

//if it is just ID this works
alert(value1.innerHtml);

But, cant get the value of the server side controls because it wont allow the usage of (.clientID) , during string concatenation.
 
Share this answer
 
v2
It should work ... What error or issue you are facing ? Elaborate your situation please
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900