requiredvalidator for checkbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SStory

    #1

    requiredvalidator for checkbox

    Is there no way to require a checkbox to be checked in ASP.NET?
    The requiredvalidat or 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

    #2
    Re: requiredvalidat or 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_Story@on line.msn.com <remove the 'online.' to send me
    mail> wrote in message news:euuXhosVDH A.2040@TK2MSFTN GP11.phx.gbl...[color=blue]
    > Is there no way to require a checkbox to be checked in ASP.NET?
    > The requiredvalidat or 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
    >
    >[/color]


    Comment

    • Marina

      #3
      Re: requiredvalidat or 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_Story@on line.msn.com <remove the 'online.' to send me
      mail> wrote in message news:ew$9nrsVDH A.2104@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Yeah I know, but when I click ControlToValida te for, the checkbox controls
      > don't list????
      >
      > How did you handle that?
      >
      > "Marina" <zlatkinam@nosp am.hotmail.com> wrote in message
      > news:errZRqsVDH A.652@tk2msftng p13.phx.gbl...[color=green]
      > > 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_Story@on line.msn.com <remove the 'online.' to send me
      > > mail> wrote in message news:euuXhosVDH A.2040@TK2MSFTN GP11.phx.gbl...[color=darkred]
      > > > Is there no way to require a checkbox to be checked in ASP.NET?
      > > > The requiredvalidat or control doesn't work for it--should I make a
      > > > server--roundtrip for that and check during the btn_click event? Is[/color][/color]
      > there[color=green][color=darkred]
      > > > another way?
      > > >
      > > > Thanks,
      > > > Shane
      > > >
      > > >[/color]
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • SStory

        #4
        Re: requiredvalidat or for checkbox

        Muchas gracias! :)

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

        Shane

        "Marina" <zlatkinam@nosp am.hotmail.com> wrote in message
        news:OHCzSusVDH A.2016@TK2MSFTN GP09.phx.gbl...[color=blue]
        > custom validators do not require you to set that property. You can leave[/color]
        it[color=blue]
        > blank. Be sure to define a javascript function, and list it in the[/color]
        property[color=blue]
        > that speficies which client side function to run for the validation.
        >
        > "SStory >" <Shane_Story@on line.msn.com <remove the 'online.' to send me
        > mail> wrote in message news:ew$9nrsVDH A.2104@TK2MSFTN GP10.phx.gbl...[color=green]
        > > Yeah I know, but when I click ControlToValida te for, the checkbox[/color][/color]
        controls[color=blue][color=green]
        > > don't list????
        > >
        > > How did you handle that?
        > >
        > > "Marina" <zlatkinam@nosp am.hotmail.com> wrote in message
        > > news:errZRqsVDH A.652@tk2msftng p13.phx.gbl...[color=darkred]
        > > > I've used a CustomValidator , and wrote some client side javascript to[/color][/color][/color]
        do[color=blue][color=green][color=darkred]
        > > > 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[/color][/color][/color]
        were[color=blue][color=green][color=darkred]
        > > > being displayed in a validation summary, so it was more convenient.
        > > >
        > > > "SStory >" <Shane_Story@on line.msn.com <remove the 'online.' to send[/color][/color][/color]
        me[color=blue][color=green][color=darkred]
        > > > mail> wrote in message news:euuXhosVDH A.2040@TK2MSFTN GP11.phx.gbl...
        > > > > Is there no way to require a checkbox to be checked in ASP.NET?
        > > > > The requiredvalidat or control doesn't work for it--should I make a
        > > > > server--roundtrip for that and check during the btn_click event? Is[/color]
        > > there[color=darkred]
        > > > > another way?
        > > > >
        > > > > Thanks,
        > > > > Shane
        > > > >
        > > > >
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...