Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify When Validators Fire?

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
hey guys,

I've got a page that I'd like to use the validator controls on, but I've got one problem:
- User clicks Add, validtors fire - GOOD!
- User clicks Cancel, validators fire - BAD!
- User clicks close, validators fire - MORE BAD!

Is there any way that I can fire the validators only when the cmdAdd button is pressed, or do they have to trigger on every postback?

Thanks,

jack
 
there is a property on the buttons called "CausesValidation". Set this property to false and the Validation controls will not fire.

 
I could find any work around for this Jack. On my apps I gave up on them and wrote the logic into the button onclick event.

I ended up using style sheets to display anything with a "error" id a certain way.
I then used a panel and programmatically created labels with id "error" to display an error message.

Sorry to dissapoint That'l do donkey, that'l do
[bravo]
 
Hey guys, thanks for the posts.

Alcar:
Thanks for the heads up, the property works for almost everything. I have one issue though:

I've got a datagrid with a select and a delete button (template column). When I set those buttons to be false for causing validation, they no longer fire their code behind.

Runat = server, and the Handles suffic is at the end of the sub. Anything you know of that needs to be done differently for buttons within a datagrid?

Thanks again,

Jack
 
nm Al,

I just had to rebuild my solution, the .vb file hadn't been re-compiled with the new code.

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top