473,395 Members | 1,783 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,395 software developers and data experts.

Validator question on positioning

I have about 8 validators on my page and I want to show the error message
next to or below the field that has the error,
but I also want to put 1 message on the top of the page and one on the
bottom of the page that just says something like:

"Errors in some of the fields"

I don't want to put the validators in multiple places and I don't want 8
messages on the bottom if 8 fields have problems.

Is there a way to do this?

Thanks,

Tom
Nov 19 '05 #1
6 1062
You can position the individual validation controls next to the control that
is being validated. Then you can put a ValidationSummary at the both and
the bottom with a HeaderText="Errors in some of the fields". As long as you
don't provide an ErrorMessage property for each of the validation controls,
then the summary will only show the HeaderText.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have about 8 validators on my page and I want to show the error
message
next to or below the field that has the error,
but I also want to put 1 message on the top of the page and one on the
bottom of the page that just says something like:
"Errors in some of the fields"

I don't want to put the validators in multiple places and I don't want
8 messages on the bottom if 8 fields have problems.

Is there a way to do this?

Thanks,

Tom


Nov 19 '05 #2
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:85**********************@msnews.microsoft.com ...
You can position the individual validation controls next to the control
that is being validated. Then you can put a ValidationSummary at the both
and the bottom with a HeaderText="Errors in some of the fields". As long
as you don't provide an ErrorMessage property for each of the validation
controls, then the summary will only show the HeaderText.
That would be perfect.

Also, I tried using it (without leaving the ErrorMessage property out) and
the Header is displayed in Red and the bullets are in Black. Is there a way
to make it all Red?

Thanks,

Tom
-Brock
DevelopMentor
http://staff.develop.com/ballen
I have about 8 validators on my page and I want to show the error
message
next to or below the field that has the error,
but I also want to put 1 message on the top of the page and one on the
bottom of the page that just says something like:
"Errors in some of the fields"

I don't want to put the validators in multiple places and I don't want
8 messages on the bottom if 8 fields have problems.

Is there a way to do this?

Thanks,

Tom


Nov 19 '05 #3
> Also, I tried using it (without leaving the ErrorMessage property out)
and the Header is displayed in Red and the bullets are in Black. Is
there a way to make it all Red?


ForeColor="Red"

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #4
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:85**********************@msnews.microsoft.com ...
Also, I tried using it (without leaving the ErrorMessage property out)
and the Header is displayed in Red and the bullets are in Black. Is
there a way to make it all Red?
ForeColor="Red"


I tried that.

I even put the Hex values in. I also put it in both the Validator and the
Summary:

<asp:RequiredFieldValidator ForeColor="#FF0000"
ControlToValidate="SearchName"
Text="<br>You must enter a Search Name"
ErrorMessage="Need a Search Name"
Display="Dynamic"
Font-Size="10px"
runat="server" />
<asp:CustomValidator ForeColor="#FF0000"
ControlToValidate="SearchName"
OnServerValidate="ValidateSearchName"
Font-Size="10px"
Display="Dynamic"
Text="<br>Search Name already exists!"
ErrorMessage="Search Name already Exists"
runat="server" />

<asp:ValidationSummary
HeaderText="Some of the fields are entered improperly or are
missing."
ForeColor="#FF0000"
runat="server"/>

Again, the headertext is red, but the bullet items are black.

Tom
-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #5
I just tried this, and it shows the bullet in red if no character is entered:

<asp:TextBox ID="SearchName" Runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1"
ForeColor="#ff0000"
ControlToValidate="SearchName"
Text="<br>You must enter a Search Name"
ErrorMessage="Need a Search Name"
Display="Dynamic"
Font-Size="10px"
runat="server" BackColor="#ffffff"
/>

<asp:ValidationSummary ID="ValidationSummary1"
HeaderText="Some of the fields are entered improperly or are missing."
ForeColor="#FF0000"
runat="server"
BackColor="#ffffff"
/>

<asp:Button ID="Button1" Runat="server" Text="Button" />

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"tshad" <ts**********@ftsolutions.com> wrote in message
news:uW****************@tk2msftngp13.phx.gbl...
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:85**********************@msnews.microsoft.com ...
Also, I tried using it (without leaving the ErrorMessage property out)
and the Header is displayed in Red and the bullets are in Black. Is
there a way to make it all Red?


ForeColor="Red"


I tried that.

I even put the Hex values in. I also put it in both the Validator and the Summary:

<asp:RequiredFieldValidator ForeColor="#FF0000"
ControlToValidate="SearchName"
Text="<br>You must enter a Search Name"
ErrorMessage="Need a Search Name"
Display="Dynamic"
Font-Size="10px"
runat="server" />
<asp:CustomValidator ForeColor="#FF0000"
ControlToValidate="SearchName"
OnServerValidate="ValidateSearchName"
Font-Size="10px"
Display="Dynamic"
Text="<br>Search Name already exists!"
ErrorMessage="Search Name already Exists"
runat="server" />

<asp:ValidationSummary
HeaderText="Some of the fields are entered improperly or are missing."
ForeColor="#FF0000"
runat="server"/>

Again, the headertext is red, but the bullet items are black.

Tom

-Brock
DevelopMentor
http://staff.develop.com/ballen



Nov 19 '05 #6
You're right.

What you get from the summary validator is the following:

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><font color="Red">Some of the fields are entered improperly or are
missing.
<ul><li>Need a Search Name</li></ul>
</font>
</td>
</tr>
</table>

It looks absolutely correct.

But deep in one of my class files there was an entry:

p,li,ol,ul{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #333333;
text-decoration: none;
line-height: 14px;
}

This overrode the font (#333333 is sort of charcoal grey). If I remove the
style from the css file, it works fine.

I now need to find a way to override this, as I am not actually doing the UL
(asp is) so can't put a class to override the general one directly on the UL
tag.

Thanks,

Tom

I will have to find a way to override this in my
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:er**************@TK2MSFTNGP12.phx.gbl...
I just tried this, and it shows the bullet in red if no character is
entered:

<asp:TextBox ID="SearchName" Runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1"
ForeColor="#ff0000"
ControlToValidate="SearchName"
Text="<br>You must enter a Search Name"
ErrorMessage="Need a Search Name"
Display="Dynamic"
Font-Size="10px"
runat="server" BackColor="#ffffff"
/>

<asp:ValidationSummary ID="ValidationSummary1"
HeaderText="Some of the fields are entered improperly or are missing."
ForeColor="#FF0000"
runat="server"
BackColor="#ffffff"
/>

<asp:Button ID="Button1" Runat="server" Text="Button" />

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"tshad" <ts**********@ftsolutions.com> wrote in message
news:uW****************@tk2msftngp13.phx.gbl...
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:85**********************@msnews.microsoft.com ...
Also, I tried using it (without leaving the ErrorMessage property out)
and the Header is displayed in Red and the bullets are in Black. Is
there a way to make it all Red?

ForeColor="Red"


I tried that.

I even put the Hex values in. I also put it in both the Validator and
the Summary:

<asp:RequiredFieldValidator ForeColor="#FF0000"
ControlToValidate="SearchName"
Text="<br>You must enter a Search Name"
ErrorMessage="Need a Search Name"
Display="Dynamic"
Font-Size="10px"
runat="server" />
<asp:CustomValidator ForeColor="#FF0000"
ControlToValidate="SearchName"
OnServerValidate="ValidateSearchName"
Font-Size="10px"
Display="Dynamic"
Text="<br>Search Name already exists!"
ErrorMessage="Search Name already Exists"
runat="server" />

<asp:ValidationSummary
HeaderText="Some of the fields are entered improperly or are
missing."
ForeColor="#FF0000"
runat="server"/>

Again, the headertext is red, but the bullet items are black.

Tom

-Brock
DevelopMentor
http://staff.develop.com/ballen



Nov 19 '05 #7

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

Similar topics

9
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. ...
14
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These...
0
by: Tom Pearson | last post by:
I create controls and validators dynamically dependent on data at runtime. I create the control then the relevant validator(s) for it assigning the Control.ID as the control to validate. These...
1
by: rufus | last post by:
Hi, I have 2 validators (RegEx and RequiredField) validating a single field. When one of these validators fires I want it to always render in the same position as the other one. The problem is...
22
by: Trevor Orton | last post by:
Hello, I'm having a slight problem using the W3C html validator and I've reviewed the FAQ's with no luck so hopefully someone here would be kind enough to point me in the right direction. I...
1
by: Charles Harrison Caudill | last post by:
with tables there is a clean and algorithmic way to organize things, but with css which is, once you get it working, much cleaner, I have to tweak and patch and hope and pray and curse before...
3
by: Frank Rizzo | last post by:
My web page is in the FlowLayout Mode. I have 2 validators for a textbox field: a RequiredFieldValidator and RegularExpressionValidator – essentially to make sure that the user entered something...
3
by: Angelos Karantzalis | last post by:
Hi guys, I've a small problem with validators. I'm building a single .aspx file that handles all my form posts. I need to be using ASP.NET validators ( or subclasses thereof ), so what i do to...
6
by: Mark | last post by:
hi, i'm trying to position something in the top right corner of a container, but i can't seem to figure out how to get it working. here's the html <div class='thumb'><a href='image.jpg'><img...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.