asp.net - Multiple forms to get work -
i want insert same page login form , registration form. tried following:
.. <body> <form runat="server"> .. <div id="login"> inputs , validations <asp:button .. /> </div> .. <div id="register"> inputs , validations <asp:button .. /> </div> .. </form> </body>
as understand, form
tag wraps whole code inside body (webforms' concept). each 'form' (login , registration) includes validations (client side & server side). when click button, of course, sends two 'forms' not before validation controls validate fields (in 2 forms).
my goal separate them absolutely. thought not wrap code form
tag , include 2 form
tag, each form, break 'rule' , concept of webforms, guess. in addition, understood, cannot include 2 forms runat=server
. can in situation?
instead of trying have 2 forms on 1 page, forget form tag being form, container in asp.net webforms.
put login "form" on page, , put register "form" on page. thats fine ignore each other, have use validationgroup
property. set 1 validation group login bits, set register bits. if want hive them off bit futher can put them in <asp:panel>
containers let set defaultbutton
parameter, when press enter submits right "form".
when first started asp.net kept thinking oh if need do... or... doesn't come up. think of them being 2 objects on same surface.
because webforms system maintains state between postbacks can work on them desktop app.
having said that, sounds might starting out , if have choice go mvc instead of webforms.
Comments
Post a Comment