Friday, December 3, 2010

.Net - Validating page when browser doesn’t allow javascript


Introduction:

Asp.Net validation controls fail to work when the client browser doesn’t support JavaScript.

Description:

Asp.net validation controls are validations through  JavaScript. If JavaScript is turned off in client browser then the validation controls doesn’t work inserting the invalid data into the database. To check this it is suggested to usepage.isvalid property.

Page.isvalid property gets a Boolean which indicates whether the page is validated or not.


Rounded Rectangle: protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)

            {
//Insert Code

}
          }