Friday, August 14, 2009

How to identiify whether the ASP.Net web page is valid or not?

It can be achieved by both Client and Server side.

By Client Side....

function Client_Validate()
{
if(Page_ClientValidate)
alert("Invalid Page");
else
alert("Valid Page");
}

<asp:Button ID="btnsave" OnClientClick="Client_Validate();" runat="server" Text="Save" />
====================

By Server Side....

Protected Sub btnsave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If Page.IsValid Then
'.
'.
Else
'.
'.
End If
End Sub

No comments:

 
Feedback Form