Decrease Font Size
Increase Font Size
   BLOG

Page.IsValid cannot be called before validation has taken place

by bryian 2. September 2009 17:56

An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code Additional information: Page.IsValid cannot be called before validation has taken place. It should be queried in the event handler for a control that has CausesValidation=True and initiated the postback, or after a call to Page.Validate.

 

Solution: call the Page.Validate() before the Page.IsValid

if (!isValidated) 
{
     Page.Validate();
}

if (Page.IsValid)
{
     //do something here
}

Tags: , ,

Error