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

Discussion in 'ASP .Net Web Controls' started by smita, Jan 27, 2004.

  1. smita

    smita Guest

    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.
     
    smita, Jan 27, 2004
    #1
    1. Advertising

  2. smita

    Eran Amitai Guest

    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" <> wrote in message
    news:%...
    > 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.
    >
    >
     
    Eran Amitai, Jan 27, 2004
    #2
    1. Advertising

  3. smita

    smita Guest

    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" <> wrote in message
    news:#...
    > 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" <> wrote in message
    > news:%...
    > > 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.
    > >
    > >

    >
    >
     
    smita, Jan 29, 2004
    #3
  4. smita

    CMA Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:#...
    > > 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" <> wrote in message
    > > news:%...
    > > > 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.
    > > >
    > > >

    > >
    > >

    >
    >
     
    CMA, Jan 29, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    0
    Views:
    484
    John Saunders
    Aug 29, 2003
  2. Valerian John
    Replies:
    6
    Views:
    5,068
    Valerian John
    May 17, 2004
  3. nick
    Replies:
    3
    Views:
    3,201
    Eliyahu Goldin
    Dec 15, 2004
  4. nick
    Replies:
    1
    Views:
    217
    Victor Garcia Aprea [MVP]
    Dec 23, 2004
  5. Guest

    Fire server side event before client side event

    Guest, Mar 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    595
    Ken Cox [Microsoft MVP]
    Mar 18, 2005
Loading...

Share This Page