Professional Web Applications Themes

requiredvalidator for checkbox - ASP.NET General

Is there no way to require a checkbox to be checked in ASP.NET? The requiredvalidator control doesn't work for it--should I make a server--roundtrip for that and check during the btn_click event? Is there another way? Thanks, Shane...

  1. #1

    Default requiredvalidator for checkbox

    Is there no way to require a checkbox to be checked in ASP.NET?
    The requiredvalidator control doesn't work for it--should I make a
    server--roundtrip for that and check during the btn_click event? Is there
    another way?

    Thanks,
    Shane


    SStory Guest

  2. #2

    Default Re: requiredvalidator for checkbox

    I've used a CustomValidator, and wrote some client side javascript to do
    this type of check. That way you will avoid the roundtrip.

    You could just as easily forgo the validators, and just write your own
    routine for this, but I had some other validators on the page that were
    being displayed in a validation summary, so it was more convenient.

    "SStory >" <Shane_Storyonline.msn.com <remove the 'online.' to send me
    mail> wrote in message news:euuXhosVDHA.2040TK2MSFTNGP11.phx.gbl...
    > Is there no way to require a checkbox to be checked in ASP.NET?
    > The requiredvalidator control doesn't work for it--should I make a
    > server--roundtrip for that and check during the btn_click event? Is there
    > another way?
    >
    > Thanks,
    > Shane
    >
    >

    Marina Guest

  3. #3

    Default Re: requiredvalidator for checkbox

    custom validators do not require you to set that property. You can leave it
    blank. Be sure to define a javascript function, and list it in the property
    that speficies which client side function to run for the validation.

    "SStory >" <Shane_Storyonline.msn.com <remove the 'online.' to send me
    mail> wrote in message news:ew$9nrsVDHA.2104TK2MSFTNGP10.phx.gbl...
    > Yeah I know, but when I click ControlToValidate for, the checkbox controls
    > don't list????
    >
    > How did you handle that?
    >
    > "Marina" <zlatkinamnospam.hotmail.com> wrote in message
    > news:errZRqsVDHA.652tk2msftngp13.phx.gbl...
    > > I've used a CustomValidator, and wrote some client side javascript to do
    > > this type of check. That way you will avoid the roundtrip.
    > >
    > > You could just as easily forgo the validators, and just write your own
    > > routine for this, but I had some other validators on the page that were
    > > being displayed in a validation summary, so it was more convenient.
    > >
    > > "SStory >" <Shane_Storyonline.msn.com <remove the 'online.' to send me
    > > mail> wrote in message news:euuXhosVDHA.2040TK2MSFTNGP11.phx.gbl...
    > > > Is there no way to require a checkbox to be checked in ASP.NET?
    > > > The requiredvalidator control doesn't work for it--should I make a
    > > > server--roundtrip for that and check during the btn_click event? Is
    > there
    > > > another way?
    > > >
    > > > Thanks,
    > > > Shane
    > > >
    > > >
    > >
    > >
    >
    >

    Marina Guest

  4. #4

    Default Re: requiredvalidator for checkbox

    Muchas gracias! :)

    I am very glad that someone answered that question for me.

    Shane

    "Marina" <zlatkinamnospam.hotmail.com> wrote in message
    news:OHCzSusVDHA.2016TK2MSFTNGP09.phx.gbl...
    > custom validators do not require you to set that property. You can leave
    it
    > blank. Be sure to define a javascript function, and list it in the
    property
    > that speficies which client side function to run for the validation.
    >
    > "SStory >" <Shane_Storyonline.msn.com <remove the 'online.' to send me
    > mail> wrote in message news:ew$9nrsVDHA.2104TK2MSFTNGP10.phx.gbl...
    > > Yeah I know, but when I click ControlToValidate for, the checkbox
    controls
    > > don't list????
    > >
    > > How did you handle that?
    > >
    > > "Marina" <zlatkinamnospam.hotmail.com> wrote in message
    > > news:errZRqsVDHA.652tk2msftngp13.phx.gbl...
    > > > I've used a CustomValidator, and wrote some client side javascript to
    do
    > > > this type of check. That way you will avoid the roundtrip.
    > > >
    > > > You could just as easily forgo the validators, and just write your own
    > > > routine for this, but I had some other validators on the page that
    were
    > > > being displayed in a validation summary, so it was more convenient.
    > > >
    > > > "SStory >" <Shane_Storyonline.msn.com <remove the 'online.' to send
    me
    > > > mail> wrote in message news:euuXhosVDHA.2040TK2MSFTNGP11.phx.gbl...
    > > > > Is there no way to require a checkbox to be checked in ASP.NET?
    > > > > The requiredvalidator control doesn't work for it--should I make a
    > > > > server--roundtrip for that and check during the btn_click event? Is
    > > there
    > > > > another way?
    > > > >
    > > > > Thanks,
    > > > > Shane
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    SStory Guest

Similar Threads

  1. checkbox
    By wildt in forum ASP
    Replies: 8
    Last Post: May 2nd, 07:34 PM
  2. Replies: 4
    Last Post: June 13th, 02:29 AM
  3. asp checkbox
    By S. Justin Gengo in forum ASP Components
    Replies: 6
    Last Post: July 5th, 07:04 PM
  4. How can I get the checkbox's value
    By Jack in forum ASP
    Replies: 1
    Last Post: October 14th, 05:27 AM
  5. DIV, CheckBox
    By MS News in forum ASP.NET General
    Replies: 6
    Last Post: July 29th, 05:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139