Validator fires on all DataGrids

R

Reyna Michlig

I have multiple datagrids on a page and each has a
RequiredFieldValidator in the EditItemTemplate as well as on a text
box in the FooterTemplate. The problem is, when the user hits update
in the EditTemplate or Submit on the footer, it fires all the other
validators in the other grids. Anyone have any hints on how to solve
this? And, yes, all grids have to be on one page.
 
S

S. Justin Gengo

This same thing came up for someone else a while ago. I don't know if my
suggestion worked out for him or not. Each required field validator has an
enabled attribute. I checked and even if the required field validator's
enabled attribute is set to "False" it still appears in the code of the
rendered page.

Using a javascript onfocus event you should be able to enable the required
field validator(s) for the datagrid being edited and set all others to
"False".

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
R

Reyna Michlig

Thanks so much for the quick response! Unfortunately, I'm very
Java-illiterate. Would you be able to post some code regarding this??
I'd appreciate it SO much!!! Thanks again!
 
S

S. Justin Gengo

Reyna,

Now that I think about it are you using an edit button for the rows of each
grid?

If you are, you could probably get away without using javascript. In the
edit button's click event you could simple set the validators to enabled or
disabled right in the codebehind.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 

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,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top