checkbox changed event from client-side javascript -????

S

smita

Hi Jeffrey,
I have a web page on which i have a placed a checkbox . Now what i
need is ..when this checkbox is checked , i want to enable three text boxes
present on the same page.
I am aware that i need to use java script here for client side
scripting...but how exactly do i need to write this java script..i am
confused..and where will it fit in my aspx page...
Please can you guide me...
Thanx in advance:)

regards,
Smita.
 
E

Eran Amitai

Add a script block to the static section of your aspx page (for example
within the head element) with a javascript function that enables/disables
the three text boxes. Then add a call to the function from your checkbox's
onclick handler. How to add a handler depends on whether you use an HTML
control or web control. For HTML controls you just specify the onclick
attribute as you do for any html element; for web controls you have to use
the Attributes collection (add an "onclick" attribute with a string that
calls your function with the up to date checkbox value).

Eran
 
S

smita

Hi,
Thanx for the solution. I have written the function to check whether the
checkbox is enabled..but now my problem is that this checkbox which i need
to check and the three text boxes which i need to enable when the checkbox
is checked are Web Controls...How do i refer to them inside the function...

Also In my aspx page i have a Page_Load event and a OK Button Click
event....So as u have suggested to add to the Attribute Collection the click
event handle...where do i place the piece of code which adds this event
handler to the Attribute Collection of Checkbox.

I tried putting it in the Page_Load event but it does not work..where am i
Going wrong??

Also Please help me regarding how to refer to my web controls in my java
script function.

Thanx ,
Smita.
 
C

CMA

hi smita,

the way u follow is wrong i think.

if u can use asp check boxes, u can set to TRUE autopostback in that
control. so, in the checked_changed() (THIS IS SERVER SIDE, not client side
scripting.) u can check for the Checked or not and enable the server
controls that u want...

hope this helps,

CMA
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top