Tip: Disable Validation Controls in ASP.NET


ASP.Net 2.0 has new feature to group validation controls.

We can achieve smilar kind of functionality in ASP.NET  1.1 by disabling the validation controls that we do not need. Recently in one of my porjects I had to show/hide the controls based on the responses of previous controls. When the response for the hide logic is selected all you have to do is disable the validation controls that are applied to hidden validation controls in the client side javascript as follows:

document.getElementById("reqZipCode").enabled=false;

//reqZipCode is control that is hidden based on the response

Up Next
    Ebook Download
    View all
    Learn
    View all