Page.Validate() in ASP.net WebForms to run within a div? -


i developing mobile site has multiple divs. have validator set each different input, want validate elements within 1st div on click "continue."

in example, want validate first name within firstpage.

secondpage hidden until continue_click event.

<div id="firstpage" runat="server">  <h3>*first name:</h3>     <asp:textbox id="firstname" runat="server"></asp:textbox>     <asp:requiredfieldvalidator id="firstnamerequiredvalidator" runat="server"     controltovalidate="firstname" errormessage="please enter first name."     forecolor="red"></asp:requiredfieldvalidator>      <asp:button id="continue" runat="server" text="next"          onclick="continue_click" /> </div>  <div id="secondpage" runat="server">      <h3>*last name:</h3>     <asp:textbox id="lastname" runat="server"></asp:textbox>     <asp:requiredfieldvalidator id="lastnamerequiredvalidator" runat="server"     controltovalidate="lastname" errormessage="please enter last name."     forecolor="red"></asp:requiredfieldvalidator>  </div> 

what looking validation group, allow well... group validation :)

you need add validationgroup attribute requiredfieldvalidator , button

<asp:requiredfieldvalidator id="firstnamerequiredvalidator" runat="server"     controltovalidate="firstname" errormessage="please enter first name."     forecolor="red"     validationgroup="firstpage"></asp:requiredfieldvalidator>  <asp:button id="continue" runat="server" text="next"          onclick="continue_click"         validationgroup="firstpage" /> 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -