ASP.NET and Javascript

  • Thread starter Thread starter Jason .
  • Start date Start date
J

Jason .

Is it possible to reference an ASP.Net control from a JavaScript
function?

What I would like to do is determine if text has been typed into an
asp:text control. If there was I would then submit the form if the user
hits their enter button.
 
Yes.
By using the Control.ClientID property you can determine what the control's
client side ID will be so you can output Javascript that references it.
 
Yes, sure. In the normal way by id. Sometimes you would need
document.getElementById(id).

Eliyahu
 
But the real solution is to use RequiredFieldValidator object which will do
this for you and you won't need to worry about javascript.

/Lars
 
Back
Top