473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying a message contigent on another validator.

I'm using some validators for a form. If the field is invalid, the page
reloads with the error next to the field.

This works, and I like it.

I'd also like to add a separate message to the top of the page along the
lines "there appears to be an error with your submission. Please check the
form below. Items to correct appear in RED".

What would be the best way to do this? I was thinking that I could just wrap
it in a panel and set it to visible/hidden based on the validators. Is there
a way to check for ANY validator error? Something like:

if any validator = error, then panel.visibility = true

-Darrel
Nov 18 '05 #1
5 1197
look at the Validation Summary control

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"darrel" <no*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I'm using some validators for a form. If the field is invalid, the page
reloads with the error next to the field.

This works, and I like it.

I'd also like to add a separate message to the top of the page along the
lines "there appears to be an error with your submission. Please check the
form below. Items to correct appear in RED".

What would be the best way to do this? I was thinking that I could just wrap it in a panel and set it to visible/hidden based on the validators. Is there a way to check for ANY validator error? Something like:

if any validator = error, then panel.visibility = true

-Darrel

Nov 18 '05 #2
Try ValidationSummary.
I believe this is designed exactly for this purpose.
(Only been coding .NET for 1 week now though)
:-)

AJ
"darrel" <no*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I'm using some validators for a form. If the field is invalid, the page
reloads with the error next to the field.

This works, and I like it.

I'd also like to add a separate message to the top of the page along the
lines "there appears to be an error with your submission. Please check the
form below. Items to correct appear in RED".

What would be the best way to do this? I was thinking that I could just wrap it in a panel and set it to visible/hidden based on the validators. Is there a way to check for ANY validator error? Something like:

if any validator = error, then panel.visibility = true

-Darrel

Nov 18 '05 #3
> look at the Validation Summary control

Curt/Andrew:

THANKS!

Unfortunately, once again, this seems to be a control that doesn't QUITE
give me the flexibility I need.

I want to have a custom error at the top, with the specific errors showing
up at each field (with their own validator controls). I can add custom text
in the validationSummary using the HeaderText attribute. However, it insists
on also showing the errorSummaries. I can turn off the errorSummaries, but
that also turns off the HeaderText.

So not *quite* what I was working for.

Any other suggestions?

-Darrel
Nov 18 '05 #4
Let's try a different approach.

Add a label to the page that has the desired text.
When IsPostBack=false, set its Visible property to false
When IsPostBack=true, set its Visible property according to the Page.IsValid
property. Do this after Page.Validate() has run (usually your post back
event handler).

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"darrel" <no*****@hotmail.com> wrote in message
news:ub**************@TK2MSFTNGP09.phx.gbl...
look at the Validation Summary control
Curt/Andrew:

THANKS!

Unfortunately, once again, this seems to be a control that doesn't QUITE
give me the flexibility I need.

I want to have a custom error at the top, with the specific errors showing
up at each field (with their own validator controls). I can add custom

text in the validationSummary using the HeaderText attribute. However, it insists on also showing the errorSummaries. I can turn off the errorSummaries, but
that also turns off the HeaderText.

So not *quite* what I was working for.

Any other suggestions?

-Darrel

Nov 18 '05 #5
Here is one I'm using:

<asp:customvalidator id=CustomValidator2 style="Z-INDEX: 111; POSITION:
relative;
TOP: 20px" runat="server"
ErrorMessage="New Password Must Contain Both Letters and Numbers"
EnableClientScript="False"
OnServerValidate="checkNewPass">*</asp:customvalidator>

Notice the * between the tags. This text will appear wherever you place
this validator on your page.
The Error Message only goes to the summary.

AJ

"darrel" <no*****@hotmail.com> wrote in message
news:ub**************@TK2MSFTNGP09.phx.gbl...
look at the Validation Summary control
Curt/Andrew:

THANKS!

Unfortunately, once again, this seems to be a control that doesn't QUITE
give me the flexibility I need.

I want to have a custom error at the top, with the specific errors showing
up at each field (with their own validator controls). I can add custom

text in the validationSummary using the HeaderText attribute. However, it insists on also showing the errorSummaries. I can turn off the errorSummaries, but
that also turns off the HeaderText.

So not *quite* what I was working for.

Any other suggestions?

-Darrel

Nov 18 '05 #6

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

Similar topics

2
2887
by: Abdul Azeem | last post by:
Hi All, I have a requirement to display a message and then redirect the controls to some file, I tried with the below method but its not working, where as If I use server.transfer or...
5
1381
by: Paul Johnson | last post by:
Can a message box be displayed using asp.net code? I know there is a System.Windows.Forms.MessageBox but i cant use it in my web pages, I always get an error message saying that Windows cannot be...
2
3404
by: Bidarkota | last post by:
I need to Display DataGrid Headers and the "no records" message when the DataGrid is empty, is there any way to achieve this. Thank you
1
1202
by: antonyliu2002 | last post by:
Suppose that I have the following on my web: Your annual income: o > o < ___________ If the user enters a number in the textbox indicated by the underline, but forget to click either of...
1
2963
by: Jeff Williams | last post by:
I have an application using dial monitors which is used in an aution room. The auctioneer has a form showing details of the current lot number. As he changes to the next lot number I need to...
5
1408
by: Shaileshsharma | last post by:
Hi, I am displaying message in c# like this Response.Write("<script>alert( 'Sum is 50' )</script>"); it is working fine,but it is not working when we take variable in aleart like int a=25;...
1
2172
by: nekha | last post by:
how to send alert message to another member now iam in online using scripts
0
823
by: menyki | last post by:
Below is a little code i wrote to display values on another form called recordForm. The code is writen on a form called regForm.pls can somebody help tell me what to do cos is not running. ...
2
1653
by: mwgjr | last post by:
Problem – displaying a graphics form from another form’s button click event without losing the XY data plot. If the Startup form is the GraphWindow form the Graphlib.vb calls create a XY data...
0
7224
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
7118
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
7379
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...
1
7038
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
5625
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
4706
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...
0
1550
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 ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
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...

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.