Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,
How do find server control on client side?
I tried using "document.getElementById('btnBack').value;" but this gives me the text property of the button.
I want to find the id of that button inorder to enable/disable it.

Could you please tell me how do we do that?

Regards,
Lok..
Posted

Hi Lokesh,

Please try the following

C#
var btn = document.getElementById('<%=btnBack.ClientID%>');
btn.disabled=true;


Thanks,
Imdadhusen
 
Share this answer
 
Just try:
JavaScript
// to disable

document.getElementById('btnBack').disabled = true;
 
Share this answer
 
Comments
Espen Harlinn 14-Feb-11 10:13am    
Nice and simple
Sunasara Imdadhusen 20-Feb-11 23:48pm    
This may not work when you are used Update Panel because it will automatically rename with e.g. ctl00_btnBack
Sandeep Mewara 21-Feb-11 0:21am    
I agree, it will not. But based on what OP was trying it would. :)

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