ASP.NET and Javascript

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.
 
S

Steve C. Orr [MVP, MCSD]

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.
 
E

Eliyahu Goldin

Yes, sure. In the normal way by id. Sometimes you would need
document.getElementById(id).

Eliyahu
 
L

Lars Netzel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top