Sunday, March 22, 2009

ASP.NET Required Field Valuator Causes problems in Tab Container

Normally with ASP.NET Tab Container we manage to keep few Data Forms in several Tab Panels. For example, One Tab Panel has User adding Form and other one has Customer Adding Form.

In Add User View We have Few Required Filed validate controls to validate few fields and in same way Add Customer Form Also having few Required Field Validate Controls to validate some user input fields.

Add User Form and Add Customer View...







The Problem I faced is like, when we submit the Add User form with user information, the Required Field Validate Controls in Add Customer Form are also fired. Then as the result, nothing is happened. Finally I found the solution for this after browsing the internet few minutes.

We need to have value for ValidationGroup Property in the Required Filed Validate Controls and for the same form every Validate Controls should have same value for Validation Group Property. And also make sure to set ValidationGroup property for the button in the form as the same value as the form's Validate Controls.


Then what happens I like, when the button press, it only validates Controls which are in the Same Group as it's ValidationGroup Property.







Cool everything went successfully.

Lakmal Kankanamge.