Change Textbox format when Validation fails in GridView

G

Guest

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
 
I

intrader

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.
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top