DooVoo Posted January 11, 2006 Share Posted January 11, 2006 I'm currently writing a multi-page form that makes use of the .NET validation web components. However, once I add an onClick event to the submit button (to control the multi-page state) it breaks the validation. According to my reading the onClick event should cause a postback event which I thought would cause the validation to run. Is this not the case? If not, is there a way to solve this neatly?Any help would be lovely! Link to comment Share on other sites More sharing options...
aspnetguy Posted January 11, 2006 Share Posted January 11, 2006 Please post your code so we know what you have done so far. Link to comment Share on other sites More sharing options...
DooVoo Posted January 12, 2006 Author Share Posted January 12, 2006 Post Code? Ah yes, I might have wanted to do that! Heh, sorry!I've managed to solve the issue, for people having the same problem in the future you can check is a page is valid manually.So, imagine you have a button that calls the function "button_click" you will have a function like so: protected void button_click(Object Source, EventArgs E){ if (Page.IsValid) { // Your Code Here }} This will cause your code to only be executed so long as the web controls pass any validation controls you have set. Link to comment Share on other sites More sharing options...
aspnetguy Posted January 12, 2006 Share Posted January 12, 2006 lol that was the easiest question I have ever had to answer...*wink* Glad it worked out! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now