Javascript with Webcontrols

P

Peter Afonin

Hello,

I'd used before methods like RegisterStartupScript with ASP.NET, but this
problem I was unable to solve yet using this method.

I have a web form with a few web controls - textbox, dropdown lists,
calendar control. If the textbox has a value- I need to disable all other
controls when it looses focus (onblur event), if it's empty - enable them.
The texbox I can replace with a HTML control instead of web control, but the
other controls I cannot.

Is it possible to do this?

I would appreciate your help on this.

Thank you,
 
D

Darrin

I assume when you say web controls, you are talking about the ASP.NET
server controls instead of plain html controls. You should be able to
do the same actions on a server control on the client as you would with
an html control alone. The key (for me at least when I first messed
with it) is to use the ClientID property of the control server side to
get what the control id will be when accessing it from javascript on
the client. I would then send my script the way you had mentioned.

-Darrin
 
A

aruanavekar

Did you tried specifying ID and runat attributes to respected HTML tags
and access them by thier ID names from the webform?

Aru
 
P

Peter Afonin

Hello,

Thank you for all your suggestions.

Yes, all my web controls have IDs. But the problem is that Javascript
doesn't "see" server controls! Maybe I'm doing something wrong, but I could
never make it work. Every time I was using Javascript with the web forms I
had to either use HTML controls with runat="server" tag or to register a
Javascript with RegisterStartupScript method.

Thank you,

Peter
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top