Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > checkbox changed event from client-side javascript -????

Reply
Thread Tools

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

 
 
smita
Guest
Posts: n/a
 
      01-27-2004
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.


 
Reply With Quote
 
 
 
 
Eran Amitai
Guest
Posts: n/a
 
      01-27-2004
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

"smita" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
 
smita
Guest
Posts: n/a
 
      01-29-2004
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.



"Eran Amitai" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> 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
>
> "smita" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
CMA
Guest
Posts: n/a
 
      01-29-2004
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


"smita" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>
>
> "Eran Amitai" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > 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
> >
> > "smita" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > 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.
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox changed event in gridview-help Vinay.d ASP .Net 0 07-13-2006 07:09 AM
Checkbox changed by browser after running javascript NnlGggTuqPvt@spammotel.com Javascript 6 10-14-2005 08:03 PM
RadioButton (or Checkbox) event firing if selected (not changed) tshad ASP .Net 5 03-15-2005 09:36 AM
CheckBox Changed Event Not Firing in DataGrid shiv ASP .Net Web Controls 0 06-18-2004 08:33 PM
HELP - select all checkbox javascript works fine.. unless there is only one checkbox. Michael Champagne Javascript 4 04-20-2004 01:40 AM



Advertisments