CustomValidator

Discussion in 'ASP .Net' started by Jim Heavey, Dec 2, 2003.

  1. Jim Heavey

    Jim Heavey Guest

    I have the following code to create a CustomValidator control in code:

    '* Add Custom Validator
    Dim cvl1 As New CustomValidator()
    cvl1.ID = "cvlAddRating"
    cvl1.Display = ValidatorDisplay.Dynamic
    cvl1.ControlToValidate = "ddladdRating"
    cvl1.ErrorMessage = "Must make a selection"
    cvl1.EnableClientScript = "False"

    Now I want to associate this control to the event for the "ServerValidate"
    event. How do I do this. I thught maybe the following code was part of
    the solution, but not all.

    Dim it As New System.Web.UI.WebControls.ServerValidateEventHandler
    (AddressOf Me.ValidateDropDownSelection)

    Am I headed in the right direction? How do I assign "it" to the control
    (cvl1)?
     
    Jim Heavey, Dec 2, 2003
    #1
    1. Advertising

  2. Jim Heavey wrote:

    > Now I want to associate this control to the event for the
    > "ServerValidate" event. How do I do this.


    Just double click the control and start typing.

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)
     
    Frank Oquendo, Dec 2, 2003
    #2
    1. Advertising

  3. Jim Heavey

    Jim Heavey Guest

    "Frank Oquendo" <> wrote in news:eqz7K6RuDHA.1596
    @TK2MSFTNGP10.phx.gbl:

    > Jim Heavey wrote:
    >
    >> Now I want to associate this control to the event for the
    >> "ServerValidate" event. How do I do this.

    >
    > Just double click the control and start typing.
    >


    As my original note indicated, I am doing all of this in code, so there is
    no object from me to double click on!
     
    Jim Heavey, Dec 2, 2003
    #3
  4. Jim Heavey wrote:

    > As my original note indicated, I am doing all of this in code, so
    > there is no object from me to double click on!


    So it did. My mistake. Try something like this:

    this.CustomValidator1.ServerValidate +=
    new ServerValidateEventHandler(CustomValidator1_ServerValidate);

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)
     
    Frank Oquendo, Dec 2, 2003
    #4
  5. Jim Heavey

    Jim Heavey Guest

    Thanks!!!!!!!!!
     
    Jim Heavey, Dec 3, 2003
    #5
    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. Edmilson

    Errormessage in CustomValidator

    Edmilson, Jul 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    393
    Edmilson
    Jul 10, 2003
  2. Wayne MJ

    CustomValidator limitation?

    Wayne MJ, Jul 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    354
    Wayne MJ
    Jul 21, 2003
  3. George Ter-Saakov

    CustomValidator controls

    George Ter-Saakov, Jul 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    381
    George Ter-Saakov
    Jul 21, 2003
  4. George Ter-Saakov

    CustomValidator bug?

    George Ter-Saakov, Jul 22, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    590
    George Ter-Saakov
    Jul 22, 2003
  5. Art Kedroski
    Replies:
    0
    Views:
    362
    Art Kedroski
    Jul 26, 2003
Loading...

Share This Page