Validation issue
In a program I have 1 multiview with several views into it (where views are menu options).
The problem is my error message already shows up from the moment I click on the menu option (a certain view).
After input it disapears and when I leave it empty for the next input, the error message comes back.
So in other words it works fine, but when I click on the menu that error message should not be there (when the page loads/shows for the 1st time).
EDIT: a (IsPostBack) within a function seemed to have solved the issue.
IsPostBack c开发者_StackOverflowan be so confusing at time :>
I would recommend wrapping all of your controls with a unique ValidationGroup per view. The problem is that all validation is firing on postback, so any validation control (hidden or not) that is invalidated will show the message as long as it is within the current view. You will also need to add the same ValidationGroup to the buttons that are navigating between the Views. I would also bet that you are not checking if Page.IsValid() is true before navigating to the next view. If you do, you will notice that you will not be able to navigate away from the current view because the validators in the other views are invalidated.
You can also set CausesValidation on any button to False to prevent any validation from firing.
精彩评论