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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Validator in DataGrid EditItem

Status
Not open for further replies.

wsmall73

Programmer
May 23, 2002
261
US
I am trying to use a custom validator inside of a Datagrid...(forgive me I am going off of memory here)- no client side javasript.

<asp:CustomValidator id=&quot;cv_categories&quot; runat=&quot;server&quot; CommandName=&quot;ServerValidate&quot;> </asp:CustomValidator>


cs-

public void ServerValidate(object Send, etc args)
{
args.IsValid=false;
}

It is firing the method and setting args.IsValid to false but still allows the user to update and return from the edititem event (the undesired result). Any ideas would be greatly appreciated..
-Wayno
 
Are you checking if Page.IsValid when you run the update in that event handler?

That should be the first thing you check, and then just abort unceremoniously if (!IsValid)

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Thanks Paul... that's exactly what I was missing... thought the validation summary would do this for me (wrong assumption obviously)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top