To work around this problem, insert the following code in your ASP.NET page, and then modify it to fit your particular application requirements.
You cannot call the
Page.IsValid property before validation has occured. Query the
Page.IsValid property in the event handler for a control when the value of the
CausesValidation property is True or after the
Page.IsValid method has been called.
<%@ page %>
<script runat=server language=c#>
public void Page_Load(object s, EventArgs e)
{
//Validate();
if (Page.IsValid)
Response.Write("Valid");
}
</script>
<form runat=server>
<input type=text runat=server id=mytext>
<input type=submit runat=server>
<asp:RequiredFieldValidator id="RequiredFieldValidator1"
ControlToValidate="mytext"
Display="Static"
InitialValue="" Width="100%" runat=server>
Fill in a value!
</asp:RequiredFieldValidator>
</form>