Client-side enable/disable

Discussion in 'ASP .Net Web Controls' started by Erik J Sawyer, Nov 20, 2003.

  1. Is there an way, using the built-in functionality of the
    web controls, to tie two controls together so that the
    value of one will enable/disable another *on the client
    side* (no postback).

    For example, I'd like to have a textbox that is disabled
    by default, but can be enabled by ticking a checkbox on
    the form. This seems simple enough that a postback would
    be overkill.

    Thanks,
    Erik J Sawyer
    Erik J Sawyer, Nov 20, 2003
    #1
    1. Advertising

  2. Erik J Sawyer

    Jon Paugh Guest

    Yes, use javascript. In the onclick event for the checkbox
    call javascript to enable/disable your textbox.

    You can do the same thing server side thru .net, but of
    course it requires a round-trip.

    Issue: when you postback will your control still be
    disabled (ie. does viewstate still work in this case?)

    >-----Original Message-----
    >Is there an way, using the built-in functionality of the
    >web controls, to tie two controls together so that the
    >value of one will enable/disable another *on the client
    >side* (no postback).
    >
    >For example, I'd like to have a textbox that is disabled
    >by default, but can be enabled by ticking a checkbox on
    >the form. This seems simple enough that a postback would
    >be overkill.
    >
    >Thanks,
    >Erik J Sawyer
    >.
    >
    Jon Paugh, Nov 20, 2003
    #2
    1. Advertising

  3. Thanks, I knew that was an option. However, I was hoping
    that the Web controls could provide the scripting for me
    (much like the validation controls or the autopostback
    controls). Looks like that's not the case.

    Thanks,
    Erik J Sawyer

    >-----Original Message-----
    >Yes, use javascript. In the onclick event for the

    checkbox
    >call javascript to enable/disable your textbox.
    >
    >You can do the same thing server side thru .net, but of
    >course it requires a round-trip.
    >
    >Issue: when you postback will your control still be
    >disabled (ie. does viewstate still work in this case?)
    >
    >>-----Original Message-----
    >>Is there an way, using the built-in functionality of

    the
    >>web controls, to tie two controls together so that the
    >>value of one will enable/disable another *on the client
    >>side* (no postback).
    >>
    >>For example, I'd like to have a textbox that is

    disabled
    >>by default, but can be enabled by ticking a checkbox on
    >>the form. This seems simple enough that a postback

    would
    >>be overkill.
    >>
    >>Thanks,
    >>Erik J Sawyer
    >>.
    >>

    >.
    >
    Erik J Sawyer, Nov 20, 2003
    #3
  4. Erik J Sawyer

    Alvin Bruney Guest

    you would have to use validation controls and point one control to the
    other. I'd go with the javascript idea though for no particular reason

    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits
    "Erik J Sawyer" <> wrote in message
    news:018f01c3af90$5c7838c0$...
    > Thanks, I knew that was an option. However, I was hoping
    > that the Web controls could provide the scripting for me
    > (much like the validation controls or the autopostback
    > controls). Looks like that's not the case.
    >
    > Thanks,
    > Erik J Sawyer
    >
    > >-----Original Message-----
    > >Yes, use javascript. In the onclick event for the

    > checkbox
    > >call javascript to enable/disable your textbox.
    > >
    > >You can do the same thing server side thru .net, but of
    > >course it requires a round-trip.
    > >
    > >Issue: when you postback will your control still be
    > >disabled (ie. does viewstate still work in this case?)
    > >
    > >>-----Original Message-----
    > >>Is there an way, using the built-in functionality of

    > the
    > >>web controls, to tie two controls together so that the
    > >>value of one will enable/disable another *on the client
    > >>side* (no postback).
    > >>
    > >>For example, I'd like to have a textbox that is

    > disabled
    > >>by default, but can be enabled by ticking a checkbox on
    > >>the form. This seems simple enough that a postback

    > would
    > >>be overkill.
    > >>
    > >>Thanks,
    > >>Erik J Sawyer
    > >>.
    > >>

    > >.
    > >
    Alvin Bruney, Nov 21, 2003
    #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. Dave Caton
    Replies:
    7
    Views:
    8,034
    =?Utf-8?B?SWJyYWhpbSBTaGFtZWVxdWU=?=
    Jul 15, 2004
  2. M O J O

    Client-side enable/disable button

    M O J O, Jan 29, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    5,858
  3. Boss302
    Replies:
    0
    Views:
    1,024
    Boss302
    Nov 21, 2006
  4. Bogdan
    Replies:
    2
    Views:
    639
    Bogdan
    Jun 9, 2008
  5. Zoe Hart
    Replies:
    1
    Views:
    355
    Scott Wisniewski
    Jan 8, 2004
Loading...

Share This Page