Hello Friend, In asp.net when you are trying to access a server side control in javascript you can't directly access the control through its ID you need to make use of ClientID which is automatically generated by Asp.Net engine for every server side control. That means whenever you have to access a server side control in your javascript you need to make use of the ClientID generated by the Asp.net Engine.
just make change in your following line.
var t = document.getElementById('txtdeptdesc').value;
Replace the above line by below line.
var t = document.getElementById('<%=txtdeptdesc.ClientID%>').value;
Ish BandhuPosted Mar 18, 2013, 1:35 AM
Vishal GilbilePosted Mar 18, 2013, 1:29 AM
In asp.net when you are trying to access a server side control in javascript you can't directly access the control through its ID you need to make use of ClientID which is automatically generated by Asp.Net engine for every server side control. That means whenever you have to access a server side control in your javascript you need to make use of the ClientID generated by the Asp.net Engine.
just make change in your following line.
var t = document.getElementById('txtdeptdesc').value;
Replace the above line by below line.
var t = document.getElementById('<%=txtdeptdesc.ClientID%>').value;
Hope that solves your problem.
With Regards,
Vishal Gilbile.