Calling IsValid in a web control

Discussion in 'ASP .Net Building Controls' started by Simon Harvey, Aug 5, 2004.

  1. Simon Harvey

    Simon Harvey Guest

    Hi All

    Is there anyway to check the IsValid property in a user control?

    I've made a user control that holds a number of validators. There are also
    event handlers in the control that handle button presses. The problem is
    that the IsValid property is defined on the page and isn't available in the
    control itself.

    Does anyone know how I can find out if the page is valid from inside the
    control? I dont want to have to move the event handlers out to the page code
    behind

    Many thanks all

    Simon
     
    Simon Harvey, Aug 5, 2004
    #1
    1. Advertising

  2. Simon Harvey

    DujHoD Guest

    if (Page.IsValid) { ... }

    "Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message news:<>...
    > Is there anyway to check the IsValid property in a user control?
     
    DujHoD, Aug 5, 2004
    #2
    1. Advertising

  3. Simon Harvey

    Simon Harvey Guest

    "DujHoD" <> wrote in message
    news:...
    > if (Page.IsValid) { ... }


    HI,

    Thanks for that. I thought it might be that, but given that its a static
    method, how does it know what page it's checking without passing anything to
    it.

    I'm sure that you're right, but I'm not sure how it works

    Thanks

    Simon
     
    Simon Harvey, Aug 6, 2004
    #3
  4. Simon Harvey

    DujHoD Guest

    The IsValid property is not static. "Page" isn't referring to the Page
    class, but rather the Page property of your user control (which
    returns an object of the Page class).

    http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlClassPageTopic.asp
    http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuipageclassisvalidtopic.asp

    You could also write "this.Page.IsValid."


    "Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message news:<>...
    > "DujHoD" <> wrote in message
    > news:...
    > > if (Page.IsValid) { ... }

    >
    > HI,
    >
    > Thanks for that. I thought it might be that, but given that its a static
    > method, how does it know what page it's checking without passing anything to
    > it.
    >
    > I'm sure that you're right, but I'm not sure how it works
     
    DujHoD, Aug 6, 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. DesignerX
    Replies:
    1
    Views:
    355
    Joe Molloy
    Dec 18, 2003
  2. Simon Harvey

    Calling IsValid in a web control

    Simon Harvey, Aug 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,938
    DujHoD
    Aug 6, 2004
  3. darrel

    seeing if a control isValid

    darrel, Sep 3, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,161
    darrel
    Sep 7, 2004
  4. Arti
    Replies:
    0
    Views:
    327
  5. Simon Harvey

    Calling IsValid in a web control

    Simon Harvey, Aug 5, 2004, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    106
    DujHoD
    Aug 6, 2004
Loading...

Share This Page