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

Change Textbox format when Validation fails in GridView

I have a GridView using Template columns. In my EditItemTemplate I am using
CompareValidators to check data types. When validation fails, I would like to
change the border of the textbox in question.

I thought I could loop through the ValidatorCollection during the
RowUpdating event but couldn't get the reference to the textbox. When I made
an explicit reference to a textbox I got the message that this would need to
be done in the PreInit event. However, it failed there too.

Any ideas?

Thank you
Jan 12 '06 #1
2 2511
On Thu, 12 Jan 2006 08:31:47 -0800, Walter wrote:
I have a GridView using Template columns. In my EditItemTemplate I am using
CompareValidators to check data types. When validation fails, I would like to
change the border of the textbox in question.

I thought I could loop through the ValidatorCollection during the
RowUpdating event but couldn't get the reference to the textbox. When I made
an explicit reference to a textbox I got the message that this would need to
be done in the PreInit event. However, it failed there too.

Any ideas?
I think that you are in the right direction. You need to use the
server-side DOM to navigate to your textbox. Thank you


Jan 12 '06 #2
I'm not really sure how to get to the server side DOM for this, especially
since the controls being validated are in an EditItemTemplate. Being in the
template, I've found these fields aren't available like controls outside the
grid.

Also, what event can this be done in as it can't be in the RowUpdated or
PreInit event?

"intrader" wrote:
On Thu, 12 Jan 2006 08:31:47 -0800, Walter wrote:
I have a GridView using Template columns. In my EditItemTemplate I am using
CompareValidators to check data types. When validation fails, I would like to
change the border of the textbox in question.

I thought I could loop through the ValidatorCollection during the
RowUpdating event but couldn't get the reference to the textbox. When I made
an explicit reference to a textbox I got the message that this would need to
be done in the PreInit event. However, it failed there too.

Any ideas?

I think that you are in the right direction. You need to use the
server-side DOM to navigate to your textbox.
Thank you


Jan 13 '06 #3

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

Similar topics

1
by: ben | last post by:
When running the code below the validation fails when the first line of my xml contains <legalEnvelope version="1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"...
3
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There...
5
by: Helen | last post by:
Hi I'm using ASP.NET's standard validators to display error messages when people don't fill in required fields on my form. The error messages currently show as soon as the form is loaded, but...
2
by: Oleg Ogurok | last post by:
Hi there, I have a modified ASP.NET TextBox control that formats its output as the phone number, e.g. if you enter "1234567890" it'll change the value to "123-456-7890". This is done by a...
3
by: Darin | last post by:
Is there a way to, at runtime, change a textbox to be a datetimepicker? I have a form that I allow the user to specify what field types the input boxes are. They can be regular text, integer,...
2
by: turboJeeper | last post by:
I have a form with 16 fields, 10 of which use the RequiredFieldValidator controls. I want to display a custom message when the validation fails. However, all the validators have ClientScript...
9
by: Mark G. | last post by:
Good afternoon. I have a "Fixed/2" format applied to a textbox on its property sheet. When I type data in the textbox, it is formatted correctly. But when I update the value programatically by...
7
pradeepjain
by: pradeepjain | last post by:
hii. i am developing a new form for which validation is done using php , so the error text gets displayed also,I wanted to make a improvement for form. i.e can the textfield for which validation...
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...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.