0

Multiview and Validators

by volkanuzun 11. March 2009 13:38

One of my colleague had a problem today which was an interesting one I guess. In his project, he had a multview control, and 4 views. Except the last view, each of these views had some validations. Interestingly all the validators, except the custom validation controls were working. I googled some stuff, and came up with a weird solution :).
When the user clicks the next button, in the code my friend was calling Page.Validate() and right after that Page.IsValid, however, when this button onclick is triggered, the views aren't activated yet so, the view is always valid :).

My weird fix was activate view on the button onclick, call vaidatations such as :

viewMany.ActiveViewIndex = 1;
Page.Validate();
if(!IsValid)
   return;
viewMany.ActiveViewIndex = 2;

 

any other suggestions?

Tags:

Comments are closed

Powered by BlogEngine.NET 1.6.0.0
Original Design by Laptop Geek, Adapted by onesoft