473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Calling IsValid in a web control

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
Nov 18 '05 #1
3 3735
if (Page.IsValid) { ... }

"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message news:<eS*************@TK2MSFTNGP11.phx.gbl>...
Is there anyway to check the IsValid property in a user control?

Nov 18 '05 #2

"DujHoD" <J2********@aol.com> wrote in message
news:76*************************@posting.google.co 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
Nov 18 '05 #3
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:<eX**************@TK2MSFTNGP11.phx.gbl>...
"DujHoD" <J2********@aol.com> wrote in message
news:76*************************@posting.google.co 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

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DesignerX | last post by:
when building a custom gui server control how do u get asp.net to automatically call it's IsValid() function? Thanks, Stan
2
by: darrel | last post by:
I'm stuck on some syntax. I'm building my own summary validator. I'm walking through the controls to see which ones are validator controls. Then, for each one that is, I want to check the isValid...
1
by: Mark | last post by:
We have client computers that are using Netscape 4.X, which appear to disregard all validator controls, like a RequiredFieldValidator. To deal with this issue, we write server side code that...
6
by: louise raisbeck | last post by:
Hi, I have a text box with corresponding comparevalidator as so.. <tr><td align="right">End Date :</td> <td><asp:TextBox id="dtEndDate" runat="server" onTextChanged="set_Duration"...
2
by: =?Utf-8?B?cGh5cw==?= | last post by:
I need to write a C# application that uses unmanaged C++ code. I created a C++/CLI wrapper to C++ code and encountered the following problem. Any time I try to instantiate a wrapper in C#...
6
by: Mike Chen | last post by:
We know in server code, we can check the page validated by using Page.IsValid where we put some validator controls on aspx page. I want to set some value after validating user input values on...
0
by: Arti | last post by:
Hi, I am using ASP.NET 2.0 ; Windows XP SP3 machine. In my web page i have made use of twocustom validator controls. Say, cv1 and cv2 Programatically - cv1_ServerValidate(object source,...
15
by: =?Utf-8?B?VG9tIENvcmNvcmFu?= | last post by:
I've been led to believe by several articles, particularly Eric Gunnerson's C# Calling Code Dynamically, that calling a method dynamically through Reflection was much slower than through a...
3
by: Andrew Jocelyn | last post by:
Hi I have couple of dropdown controls each with a requiredfieldvalidator. I clear the dropdownlist in the button click event. When the page is rendered the dropdown validator already flags it's...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.