Validator fires on all DataGrids

  • Thread starter Thread starter Reyna Michlig
  • Start date Start date
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.
 
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
 
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!
 
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
 
Back
Top