Reputation: 11
I am working on a application with master - child page (C#.Net), my master page is having one form with run@server tag, with multiple html form for login/registration light boxes.
Now, my problem is that, I am having one html form inside my content page, on asp button click event i am calling validate.js using form submit button but validation is happening properly but I am unable to receive postback event, every time it is treating as new page request and page loads.
Awaiting for any response. Thanks
Upvotes: 0
Views: 184
Reputation: 61914
You've got nested forms which is illegal in HTML and will never work. And also, as I said in the comments, because you're using ASP.NET WebForms you only need (and can only have) one form for the whole page (master and content). You can just use things like the "OnClick" event of your buttons to control what happens at postback subsequently.
If you want form validation, use ASP.NET's built-in validation controls, which will work and also provide vital server-side validation out of the box, which JS frameworks don't. (Client-side validation without matching server-side validation is pointless because malicious users or bots can just bypass it - never trust anything that comes from the browser).
See https://msdn.microsoft.com/en-us/library/debza5t0.aspx for details of the built-in validation controls. There's also a CustomValidator which you can use to cover anything that isn't possible with the main ones, and which plugs into the same pipeline for checking and reporting errors on both client and server-side.
P.S. Please post actual code in future, not images, so the content is searchable and copyable.
Upvotes: 1