Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Calling IsValid in a web control

Reply
Thread Tools

Calling IsValid in a web control

 
 
Simon Harvey
Guest
Posts: n/a
 
      08-05-2004
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


 
Reply With Quote
 
 
 
 
DujHoD
Guest
Posts: n/a
 
      08-05-2004
if (Page.IsValid) { ... }

"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message news:<(E-Mail Removed)>...
> Is there anyway to check the IsValid property in a user control?

 
Reply With Quote
 
 
 
 
Simon Harvey
Guest
Posts: n/a
 
      08-06-2004

"DujHoD" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> 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


 
Reply With Quote
 
DujHoD
Guest
Posts: n/a
 
      08-06-2004
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...sPageTopic.asp
http://msdn.microsoft.com/library/en...validtopic.asp

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


"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message news:<(E-Mail Removed)>...
> "DujHoD" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) m...
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to maintain the state - isvalid - in CustomValidator control. Arti ASP .Net 0 07-12-2007 10:51 AM
seeing if a control isValid darrel ASP .Net 2 09-07-2004 06:08 PM
Calling IsValid in a web control Simon Harvey ASP .Net 3 08-06-2004 01:47 PM
Calling IsValid in a web control Simon Harvey ASP .Net Building Controls 3 08-06-2004 01:47 PM
automatically calling custom isValid() function DesignerX ASP .Net 1 12-18-2003 04:35 AM



Advertisments