Validation control issue
Posted
by
Mael
on Stack Overflow
See other posts from Stack Overflow
or by Mael
Published on 2010-12-30T14:10:59Z
Indexed on
2010/12/30
15:55 UTC
Read the original article
Hit count: 315
Hello,
I have a multiview that simulates a menu with different kind 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.
© Stack Overflow or respective owner