Order of rendering events and validation

balloobille

New Member
Hey Guys,<BR><BR>What i am trying to do is a registration page that consists of a number of steps but uses only one page (im trying to do it nice an tidy): the code has been stripped bare to have 1 input per 'stage':<BR><BR>step 1: confirm that you agree to terms<BR>step 2: enter password<BR>step 3: enter address<BR>step 4: thank you...<BR><BR>This is what happens - items that are not even rendered to the page because they are not in that registration step and not output using the select case statement, are requesting validation. Eg. I can proceed to the page after entering the password, but as soon as i have hit the button and step 3 is shown, the controls on that page have requested validation.<BR><BR>If you want, copy and paste the code and check it out for yourself - if somebody knows the answer, solving this will definitely teach you something as to how asp.net renders pages etc and will be usefull to you!<BR><BR>I can do a workaround by having a diff aspx page for each step, but i like this one page clean and tidy method...<BR><BR>Any help much appreciated...<BR><BR>-------------------------------------------------------<BR><script language="vb" runat="server"><BR><BR> Dim nextstep as integer<BR> <BR> Sub Page_Load(Source as Object, e as Eventargs)<BR> nextstep=0<BR> <BR> End Sub<BR> <BR> Sub Decline(Source as Object, e as Eventargs)<BR> response.redirect ("/")<BR> End Sub<BR> <BR> Sub DoStep0(Source as Object, e as Eventargs)<BR> Nextstep=1<BR> End Sub<BR> <BR> Sub DoStep1(Source as Object, e as Eventargs)<BR> 'collect the data into sessions to store after all steps complete<BR> Nextstep=2<BR> End Sub<BR><BR> Sub DoStep2(Source as Object, e as Eventargs)<BR> response.write ("Thanks for registering<BR>")<BR> 'save everything into the database now<BR> nextstep = 99<BR> <BR> End Sub<BR> <BR> <BR> <BR></script><BR><BR><form method="POST" runat=server><BR><BR><%<BR>Select case(Nextstep)<BR>case 0<BR>%><BR> By clicking the Accept button you accept our terms!<BR> <BR><BR> <BR> <asp:button id="btnStep0" causesvalidation="False" runat=server onclick=DoStep0 text="Accept"/><BR> <asp:button id="btnDecline" causesvalidation="False" runat=server onclick=Decline text="Decline"/><BR><BR><%<BR> case 1:<BR>%> Enter a password <BR> <asp:textbox id=txtPwd textmode=password runat=server/><BR> <asp:requiredfieldvalidator id="valtxtPwdnotnull" runat="server" controltovalidate="txtPwd" errormessage="* Password is required" display="dynamic">* required</asp:requiredfieldvalidator><BR> <BR><BR> <asp:button id="btnStep1" runat=server onclick=DoStep1 text="Next >> "/><BR> <BR> <%<BR> case 2:<BR> %> <BR> Street Address: <BR> <BR> <asp:textbox id=txtStreet runat=server /><BR> <asp:requiredfieldvalidator id="valtxtStreet" runat="server" controltovalidate="txtStreet" errormessage="* Street Address is required" display="dynamic">* required</asp:requiredfieldvalidator><BR> <BR><BR> <asp:button id="btnStep2" runat=server onclick=DoStep2 text="Next >> "/><BR> <BR><%<BR>end select<BR> %><BR> <asp:validationsummary id="valSummary" runat="server" HeaderText="<b>Please check the following:</b>" showsummary="true" displaymode="list" Font-Size="10px" /><BR> <BR></form><BR>
 
Back
Top