Validation control issue
I have a multiview that simulates a menu with different 开发者_如何学JAVAkind of options.
Each view within the multiview control holds a bunch of controls (listbox, label, etc..) Everything worked just fine, until i wanted to implement Validation control(s).
For example when i click on my menu viewA gets displayed with its controls. There i wish to implement a RequiredFieldValidator.
But the problem is, if i click on a other menu option (which is in fact a other view in my multiview) then it gives the error message 'Please enter a message" which is the errorMessage of the first RequiredFieldValidator of the first menu option (first view).
All my controls are named with a unique name, so there is no mixup amongst the ControlToValidate=""
Offcourse this is not suitable, cause those menu choices are indepentant. And its not the intention i have to fill in everything, cause its a menu afterall, and not a form where i have to enter everything at once.
How can i have a RequiredFieldValidator on my views that do not take each other in account?
Some code on how my active view is handled
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
View activeView = (View)this.mvMultiview.FindControl(this.getViewFromRequest());
if (!(activeView == null))
{
this.mvMultiview.SetActiveView(activeView);
}
}
}
Thanks.
精彩评论