SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software

Development Forums for Programmer, Administrators and Users

Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.

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.

Last post 12-22-2008, 5:30 AM by eralper. 0 replies.
Sort Posts:
  •  12-22-2008, 5:30 AM 3560

    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.

    I have an asp.net web page that has validation controls on the page itself.
    I realized that when I pass the javascript required field validation controls on the asp.net page, the server side controls can catch that required fiedl validation by-pass trick by using the Page.IsValid property.
    But if you call this property before the validation status of the asp.net web page is controlled, you will get the following error message on the server side application.


    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.


    So, as the warning message itself implies, you can overcome this error by calling the Page.Validate page method prior to reading the Page.IsValid property.


    So, for example if you have the following ASP.NET code on your server side .NET code

    Return Me.Page.IsValid

    Add the "Page.Validate()" method call just before the "Page.IsValid" property is read.

    Page.Validate()
    Return Me.Page.IsValid


View as RSS news feed in XML
Copyright © 2004 - 2019 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems