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

Validators with CSS

We have Validators embedded in an asp table server control. The table
server control is necessary and cannot be replaced. We want to apply CSS
formatting to the validators, but the validators have a default RED font
that appears to be difficult to remove. We could hard code in a blank font
color into the .aspx html for each validator, but that would defeat the
purpose of the CSS.

Is there a way to change the default RED color of validators in an entire
project or a different hack?

Thanks in advance.

Mark
Nov 18 '05 #1
6 1602
If the controls are server controls (which I assume they are), you could
loop through your control collection, and when you run across a validator,
you can add an attribute to it:

myValidator.Attributes("class") = "myCssClass"

NOTE: myCssClass is the class name within your CSS file.

This might not be the best way to do it, but it does work. I know there is
also a CSS class property of web controls, I think it would be accessed like
this (but I'm unsure):

myValidator.CssClass = "myCssClass"

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:eF*************@TK2MSFTNGP12.phx.gbl...
We have Validators embedded in an asp table server control. The table
server control is necessary and cannot be replaced. We want to apply CSS
formatting to the validators, but the validators have a default RED font
that appears to be difficult to remove. We could hard code in a blank font color into the .aspx html for each validator, but that would defeat the
purpose of the CSS.

Is there a way to change the default RED color of validators in an entire
project or a different hack?

Thanks in advance.

Mark

Nov 18 '05 #2
This unfortunately would be the same as simply adding a CSS attribute in the
html. The default RED would still override the CSS styling. Other
suggestions?

Thanks in advance.

Mark

"ASP.Confused" <anonymous@> wrote in message
news:OS**************@TK2MSFTNGP09.phx.gbl...
If the controls are server controls (which I assume they are), you could
loop through your control collection, and when you run across a validator,
you can add an attribute to it:

myValidator.Attributes("class") = "myCssClass"

NOTE: myCssClass is the class name within your CSS file.

This might not be the best way to do it, but it does work. I know there is also a CSS class property of web controls, I think it would be accessed like this (but I'm unsure):

myValidator.CssClass = "myCssClass"

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:eF*************@TK2MSFTNGP12.phx.gbl...
We have Validators embedded in an asp table server control. The table
server control is necessary and cannot be replaced. We want to apply CSS formatting to the validators, but the validators have a default RED font
that appears to be difficult to remove. We could hard code in a blank

font
color into the .aspx html for each validator, but that would defeat the
purpose of the CSS.

Is there a way to change the default RED color of validators in an entire project or a different hack?

Thanks in advance.

Mark


Nov 18 '05 #3
Here's another approach. I created a replacement to Microsoft's validators
due to their numerous limitations. In mine, they all use style sheets
instead of a pre-defined font color. The product is "Professional Validation
And More" at http://www.peterblum.com/vam/home.aspx.

Professional Validation And More is designed to avoid most of the custom
coding and hacks people implement when working with Microsoft's validators.
I put together a list of the limitations in Microsoft's validators here:
http://www.peterblum.com/vam/valmain.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:eF*************@TK2MSFTNGP12.phx.gbl...
We have Validators embedded in an asp table server control. The table
server control is necessary and cannot be replaced. We want to apply CSS
formatting to the validators, but the validators have a default RED font
that appears to be difficult to remove. We could hard code in a blank font color into the .aspx html for each validator, but that would defeat the
purpose of the CSS.

Is there a way to change the default RED color of validators in an entire
project or a different hack?

Thanks in advance.

Mark

Nov 18 '05 #4

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message news:eF*************@TK2MSFTNGP12.phx.gbl...
We have Validators embedded in an asp table server control. The table
server control is necessary and cannot be replaced. We want to apply CSS
formatting to the validators, but the validators have a default RED font
that appears to be difficult to remove. We could hard code in a blank font
color into the .aspx html for each validator, but that would defeat the
purpose of the CSS.

Is there a way to change the default RED color of validators in an entire
project or a different hack?

Thanks in advance.

Mark


I have no problems removing that color: highlight the "red" in the property sheet,
press DEL and ENTER.
True, you need to do that for every validator you place of your forms/controls.

Hans Kesting
Nov 18 '05 #5
You could expand on Mark's idea, and do the color change progmatically.
That way, you don't have to worry about changing the color for every
validator control on your page (within your page load function.)


Pseudocode:

for each validator in my control collection
validator.ForeColor = Color.WhateverColorYouWant
next

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message news:eF*************@TK2MSFTNGP12.phx.gbl...
We have Validators embedded in an asp table server control. The table
server control is necessary and cannot be replaced. We want to apply CSS formatting to the validators, but the validators have a default RED font
that appears to be difficult to remove. We could hard code in a blank font color into the .aspx html for each validator, but that would defeat the
purpose of the CSS.

Is there a way to change the default RED color of validators in an entire project or a different hack?

Thanks in advance.

Mark


I have no problems removing that color: highlight the "red" in the

property sheet, press DEL and ENTER.
True, you need to do that for every validator you place of your forms/controls.
Hans Kesting

Nov 18 '05 #6
Yes, but stick that validator in an table *server* control, and can you do
it then? I'm trying to find a way for our graphical interface people to
deal with this in the .aspx page consistently or with CSS without having to
do it programatically.

Thanks again.

Mark

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:us**************@tk2msftngp13.phx.gbl...

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message news:eF*************@TK2MSFTNGP12.phx.gbl...
We have Validators embedded in an asp table server control. The table
server control is necessary and cannot be replaced. We want to apply CSS formatting to the validators, but the validators have a default RED font
that appears to be difficult to remove. We could hard code in a blank font color into the .aspx html for each validator, but that would defeat the
purpose of the CSS.

Is there a way to change the default RED color of validators in an entire project or a different hack?

Thanks in advance.

Mark


I have no problems removing that color: highlight the "red" in the

property sheet, press DEL and ENTER.
True, you need to do that for every validator you place of your forms/controls.
Hans Kesting

Nov 18 '05 #7

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

Similar topics

1
by: MonkeyBoy | last post by:
I am doing some some HTML manipulation in client-side script (IE5.x and IE6.x browsers only). Something like.. var tmpHTML = oTable.outerHTML // do something to the HTML her oTable.outerHTML =...
1
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...
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...
7
by: angus | last post by:
Dear all, I have 5 textboxes, and 2 buttons in a webform. 1-3 textboxes would be validated by 3 Required Field Validators if button 1 is click; 4-5 textboxes would be validated by 2 Required...
3
by: John Blair | last post by:
Hi, I have validators outside of a datagrid (for adding a new grid row) - however when i click "edit" column and then the "update" column of a grid row that has been edited - my other...
1
by: epigram | last post by:
I'm trying to use the ASP.NET validators to check some client-side business rules. I've got two ASP TextBox controls (call them tbxYear1 and tbxYear2) used to enter a range of years. I've got a...
1
by: Gabriel Lozano-Morán | last post by:
When using the tabstrip control combined with a multipage (several pageview) there is a problem when using validators. The problem is that validation also occurs on the validators that are not on...
2
by: Mike Surcouf | last post by:
Hi I have some regex validators on my page set to dynamic and like the way they appear after you tab out of a field and also when you try to postback the form. All OK so far When I register...
4
by: Madhur | last post by:
Hello All I am learning how to use ASP.NET Validators and would appreciate if someone could provide me with guidance. I have written very simple ASPX page below with a Dropdown list, a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.