473,796 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Manual Validate call always returns IsValid=true

This is always returning True, even when fields are empty. Why?
private bool ValidatePageOne () {
bool ret = true;
foreach (Control ctrl in PageOnePanel.Co ntrols) {
if (ctrl.GetType() .IsSubclassOf(t ypeof(BaseValid ator))) {
((BaseValidator )ctrl).Validate ();
if (!((BaseValidat or)ctrl).IsVali d)
ret = false;
}
}
return ret;
}

I should note:

Before doing this manually (using the regular page validation instead) it
worked fine. Also, I am stepping through the code and the Validator controls
are being found and Validate() is being run. Some of these are
RequiredFieldVa lidators. But the textboxes they are associated with are
empty, and yet IsValid is returning True! Why?

Jon
Nov 18 '05 #1
3 2053
I've tested that exact code with a required field, and a compare validator,
on one text field (within a panel), and it worked fine for me. I would look
elsewhere for the problem you are experiencing.

--Michael

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message
news:ud******** ********@TK2MSF TNGP10.phx.gbl. ..
This is always returning True, even when fields are empty. Why?
private bool ValidatePageOne () {
bool ret = true;
foreach (Control ctrl in PageOnePanel.Co ntrols) {
if (ctrl.GetType() .IsSubclassOf(t ypeof(BaseValid ator))) {
((BaseValidator )ctrl).Validate ();
if (!((BaseValidat or)ctrl).IsVali d)
ret = false;
}
}
return ret;
}

I should note:

Before doing this manually (using the regular page validation instead) it
worked fine. Also, I am stepping through the code and the Validator controls are being found and Validate() is being run. Some of these are
RequiredFieldVa lidators. But the textboxes they are associated with are
empty, and yet IsValid is returning True! Why?

Jon

Nov 18 '05 #2
Thanks
"Michael" <raterus@localh ost> wrote in message
news:eO******** *****@TK2MSFTNG P12.phx.gbl...
I've tested that exact code with a required field, and a compare validator, on one text field (within a panel), and it worked fine for me. I would look elsewhere for the problem you are experiencing.

--Michael

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message
news:ud******** ********@TK2MSF TNGP10.phx.gbl. ..
This is always returning True, even when fields are empty. Why?
private bool ValidatePageOne () {
bool ret = true;
foreach (Control ctrl in PageOnePanel.Co ntrols) {
if (ctrl.GetType() .IsSubclassOf(t ypeof(BaseValid ator))) {
((BaseValidator )ctrl).Validate ();
if (!((BaseValidat or)ctrl).IsVali d)
ret = false;
}
}
return ret;
}

I should note:

Before doing this manually (using the regular page validation instead) it worked fine. Also, I am stepping through the code and the Validator

controls
are being found and Validate() is being run. Some of these are
RequiredFieldVa lidators. But the textboxes they are associated with are
empty, and yet IsValid is returning True! Why?

Jon


Nov 18 '05 #3
sorry ..

"Michael" <raterus@localh ost> wrote in message
news:eO******** *****@TK2MSFTNG P12.phx.gbl...
I've tested that exact code with a required field, and a compare validator, on one text field (within a panel), and it worked fine for me. I would look elsewhere for the problem you are experiencing.

--Michael

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message
news:ud******** ********@TK2MSF TNGP10.phx.gbl. ..
This is always returning True, even when fields are empty. Why?
private bool ValidatePageOne () {
bool ret = true;
foreach (Control ctrl in PageOnePanel.Co ntrols) {
if (ctrl.GetType() .IsSubclassOf(t ypeof(BaseValid ator))) {
((BaseValidator )ctrl).Validate ();
if (!((BaseValidat or)ctrl).IsVali d)
ret = false;
}
}
return ret;
}

I should note:

Before doing this manually (using the regular page validation instead) it worked fine. Also, I am stepping through the code and the Validator

controls
are being found and Validate() is being run. Some of these are
RequiredFieldVa lidators. But the textboxes they are associated with are
empty, and yet IsValid is returning True! Why?

Jon


Nov 18 '05 #4

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

Similar topics

4
10191
by: Randell D. | last post by:
Folks, I test if my PHP should process form data by checking if $_POST is an array - However I always find its condition proves true - Why or alternatvily, what other method can one use to check for this sort of situation? <? if(is_array($_POST)) { die("<h1>here</h1>"); }
2
2225
by: vakap | last post by:
function show() { var s = '' ; for (var i = 0; i<arguments.length; s += '\n'+arguments) ; typeof(window) != 'undefined' ? window.alert(s) : WScript.Echo(s) ; } function f(){} show('delete(f):',delete(f)) ; // false g = function(){} ;
1
3777
by: Tim Begin | last post by:
I am attempting to use the ThreadPool.SetMinThreads method as shown in the MSDN example code: int minWorker, minIOPort; int newWorker,newIOPort; ThreadPool.GetAvailableThreads(out minWorker, out minIOPort); bool flag = ThreadPool.SetMinThreads(4, minIOPort); ThreadPool.GetAvailableThreads(out newWorker, out newIOPort); After running this flag is true, but the worker value is still set to 25. I am using .Net 1.1.4322 and this call was...
5
1872
by: Gernold Schneider | last post by:
I have a managed code function calling a unmanaged code function which returns a "bool". Obviously the return value is always "true", if i am not running the code in the debugger. If i run the code in the debugger, everything works fine. Is this a known bug? Example:
2
15592
by: gjtired | last post by:
Hi, I can't figure out why my HasRows code is always true. Below is a snippet of my code. sqlConnection1.Open(); //Check that quiz name is not a duplicate during the Create(0)task string cmdCheckName="SELECT Count(Quiz_Name) FROM Quiz WHERE Quiz_Name = '"+valName+"' "; SqlCommand cmdCheck = new SqlCommand(cmdCheckName, sqlConnection1); SqlDataReader drCheckName =
2
1378
by: Jeremy | last post by:
The code is in a server control: If Me.Page.IsValid Then ExecuteSomething End If ExecuteSomething is always called and the validators always return True for IsValid, even though their properties would indicate that they are invalid (RequiredField validator, InitialValue = "", CurrentValue = "", IsValid = True). Any idea why this is happening? It's driving me crazy...
59
4597
by: Pierre Quentel | last post by:
Hi all, In some program I was testing if a variable was a boolean, with this test : if v in My script didn't work in some cases and I eventually found that for v = 0 the test returned True So I changed my test for the obvious "if type(v) is bool", but I still find it confusing that "0 in " returns True
2
12169
by: a1drich | last post by:
smartCryptor.cpp: In function `void Char2Hex(unsigned char, char*)': smartCryptor.cpp:188: warning: comparison is always true due to limited range of data type void Char2Hex(unsigned char ch, char* szHex) { unsigned char byte;
12
2675
by: ross.oneill | last post by:
Hi, Is there any function in php that will match a word exactly and if it finds it, it returns true. For example if I search for "CA" strVar = "Bob is from Los Angeles CA" - return true strVar "Bob is from Canada" -- returns false
3
9022
by: jwdvorak | last post by:
In the following method: public boolean isMemberAlive(String userSsn) throws SQLException { boolean isMemberAlive = false; Connection c = null; Statement s = null; ResultSet rs = null;
0
9524
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9047
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.