473,763 Members | 8,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation Groups

asp.net 2/C#/VS2005

Using master pages

I have a page with several text boxes on it. I want to logically group
some of them. So I have a textbox that has required field and regular
expression validators for it. I also have a validation summary on the
page. For each of these four controls, I used the same value for the
"ValidationGrou p" property. I have also assigned header text for the
validation summary and error messages for the validators.

But when I run the page, don't enter anything into the text box, and
click an image button (to trigger a postback), nothing happens. No
error message shows.

Is there something else I need to do to make this work?

May 23 '07 #1
3 3492
for each postback control, you specify causesvalidatio n, and the
validation group if you want it to perform validation. this allows
different buttons to cause different validation or non.

-- bruce (sqlwork.com)
Joey wrote:
asp.net 2/C#/VS2005

Using master pages

I have a page with several text boxes on it. I want to logically group
some of them. So I have a textbox that has required field and regular
expression validators for it. I also have a validation summary on the
page. For each of these four controls, I used the same value for the
"ValidationGrou p" property. I have also assigned header text for the
validation summary and error messages for the validators.

But when I run the page, don't enter anything into the text box, and
click an image button (to trigger a postback), nothing happens. No
error message shows.

Is there something else I need to do to make this work?
May 23 '07 #2
Howdy,

I don't know why but it's by design (snippet from RegularExressio nValidator):

protected override bool EvaluateIsValid ()
{
string input = base.GetControl ValidationValue (base.ControlTo Validate);
if ((input == null) || (input.Trim().L ength == 0))
{
return true;
}
try
{
Match match = Regex.Match(inp ut, this.Validation Expression);
return ((match.Success && (match.Index == 0)) && (match.Length ==
input.Length));
}
catch
{
return true;
}
}

IMHO it looks like a big simplification (or 'screw up' would be more
convenient) from MST...

--
Milosz
"Joey" wrote:
asp.net 2/C#/VS2005

Using master pages

I have a page with several text boxes on it. I want to logically group
some of them. So I have a textbox that has required field and regular
expression validators for it. I also have a validation summary on the
page. For each of these four controls, I used the same value for the
"ValidationGrou p" property. I have also assigned header text for the
validation summary and error messages for the validators.

But when I run the page, don't enter anything into the text box, and
click an image button (to trigger a postback), nothing happens. No
error message shows.

Is there something else I need to do to make this work?

May 23 '07 #3
Howdy,

I actually missed one thing in the documentation:
"Note Validation succeeds if the input control is empty. If a value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control. ". So you
have to add RequiredFieldVa lidator for the same control.

Regards
--
Milosz
"Milosz Skalecki [MCAD]" wrote:
Howdy,

I don't know why but it's by design (snippet from RegularExressio nValidator):

protected override bool EvaluateIsValid ()
{
string input = base.GetControl ValidationValue (base.ControlTo Validate);
if ((input == null) || (input.Trim().L ength == 0))
{
return true;
}
try
{
Match match = Regex.Match(inp ut, this.Validation Expression);
return ((match.Success && (match.Index == 0)) && (match.Length ==
input.Length));
}
catch
{
return true;
}
}

IMHO it looks like a big simplification (or 'screw up' would be more
convenient) from MST...

--
Milosz
"Joey" wrote:
asp.net 2/C#/VS2005

Using master pages

I have a page with several text boxes on it. I want to logically group
some of them. So I have a textbox that has required field and regular
expression validators for it. I also have a validation summary on the
page. For each of these four controls, I used the same value for the
"ValidationGrou p" property. I have also assigned header text for the
validation summary and error messages for the validators.

But when I run the page, don't enter anything into the text box, and
click an image button (to trigger a postback), nothing happens. No
error message shows.

Is there something else I need to do to make this work?
May 23 '07 #4

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

Similar topics

2
1149
by: Ing. Rajesh Kumar | last post by:
Hi everybody Validation controls are great but i have a scenario where i do not know how to use them so i am doing my validation on the server. Let's say I have a Web Form with : Two Textboxes : Textbox_1, Textbox_2 Two Checkboxes : Checkbox_1, Checkbox_2 A Button : btnSubmit What I want is : If Checkbox_1 is checked then Textbox_1 is required and it should contain
3
2831
by: john morales | last post by:
Hi guys, I have a problem and i know there must be a solution for this as it is such a basic common practice in asp.net development. Scenario: i have many webforms in a site, most with two different custom controls, one is a login module, the other is a generic data entry module. When there are no validation controls on the page there is no problem. But when the the data entry module has validation controls, the login module triggers...
4
2976
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are linkbuttons which must not cause validation. I have found a setting "causeValidation" to disable the validation. Also on the page, I have a datagrid that I will edit lines on. I can click
1
2384
by: Kris | last post by:
Hi, I have a DataGrid where in each row has couple of text boxes and an update button. Each row is dynamically generated as the number of rows are not known ahead of time. When the user clicks the update button, I do a postback to capture the data entered. However I dont want to do a postback when the textboxes are empty. How do I prevent this using Clientside validation? This is a common problem and if it has been beaten to death, please...
1
1501
by: MattC | last post by:
I have a user control that contains several requiredFieldValidators. The page the control sits in has other RequiredFieldValidators. On submitting the form all the validators on the page fire and correctly validate. The validators in the control seem to validate but do not return true/IsValid as so my form is not submitted. I would like to do this ClientSide, the only resolution I can find is to perform the validation for the...
4
2710
by: ibiza | last post by:
Hi all, I have a small question concerning asp.net 2.0 validation groups. I have this (simplified) situation : Name Value _____ _____ |_____| |_____| _____ _____ |_____| |_____|
1
3825
by: misiek | last post by:
Hi all. I have following problem: I have some user control called smallUserContrl, in which I have two RangeValidator controls. I set their ValidationGroup property to smallUserControlGroup. Also I have another user control called bigUserControl, in which I use smallUserControl. BigUserControl also has some validator, which has ValidationGroup property set to bigUserControlGroup.
1
3193
by: brantman | last post by:
Here is a question that needs to be revisited. I noticed that there are more that a few posts about this in this group and in custom controls. Here is the problem: When inheriting from a webcontrol, say textbox for example, and implementing the IValidator interface to make the control self-validating, the control fails to participate in validation groups. Using reflector, it is easy to see why; the page.validator casts all the controls in...
2
452
by: moondaddy | last post by:
How can I have a page with 2 different groups of controls (where each group of controls contain textboxes, validation controls and a submit button) and each group operate independently? for example, when the user clicks on the first submit button, it wont submit unless all the controls in group 1 are valid, likewise, when the user clicks on the 2nd submit button, it wont submit unless all the controls in group 2 are valid. thanks.
1
1229
by: Velvet | last post by:
Does anyone know a way to force the client script to preform a client-side validation for controls in validation groups? What is currently happening is I have two validation groups (Billing, CreditCard). The validation doesn't happen until the submit button is pressed and the server validation happens. I added an OnClickClient event to the submit button that pops up a comfirm box, but it pops before any validation happens. What I...
0
10002
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...
1
9938
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7368
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
6643
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
5270
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...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2794
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.