473,660 Members | 2,475 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.visibilit y = true

-Darrel
Nov 18 '05 #1
5 1209
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*****@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.visibilit y = true

-Darrel

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

AJ
"darrel" <no*****@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.visibilit y = 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 validationSumma ry 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=fals e, 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****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"darrel" <no*****@hotmai l.com> wrote in message
news:ub******** ******@TK2MSFTN GP09.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 validationSumma ry 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:customvali dator id=CustomValida tor2 style="Z-INDEX: 111; POSITION:
relative;
TOP: 20px" runat="server"
ErrorMessage="N ew Password Must Contain Both Letters and Numbers"
EnableClientScr ipt="False"
OnServerValidat e="checkNewPass ">*</asp:customvalid ator>

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*****@hotmai l.com> wrote in message
news:ub******** ******@TK2MSFTN GP09.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 validationSumma ry 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
2904
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 server.execute it works but I cant give relative Url (it will dynamically genrate), If any one has an alternate way, pls respond. ShowMessage("Hello World") Sub ShowMessage(sMessage)
5
1386
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 found in System namespace.
2
3412
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
1213
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 the two radio buttons for ">" and "<", I want to warn the user that if he does supply a (valid) number for the annual income information, he must check one radio button.
1
2972
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 send a message to a form on the other monitor to change to picture to this new lot. Shat is the best way to have a form send a message to another form. ie Monitor one is showing lot 10 details and the monitor two is showing the picture of lot...
5
1413
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; int b=25; int sum=a+b; Response.Write("<script>alert(sum)</script>");
1
2179
by: nekha | last post by:
how to send alert message to another member now iam in online using scripts
0
828
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. Private Sub enterButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles enterButton.Click Dim arecordForm As New recordForm Dim aregForm As New regForm arecordForm.snamerLabel.Text = snameTextBox.Text ...
2
1666
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 plot. Code outline (not everything included): (Sub GraphWindow_Paint(ByVal sender As Object, ByVal e As Sys…PaintEventArgs) _ Handles Me.Paint) Call Graphscale(xmin, xmax, ymin, ymax) Call DrawAxis(10,10) XY data Call GraphPlot End Sub
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
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
8851
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
8630
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...
0
7360
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
6181
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
4176
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
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2759
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

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.