|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Wizard Next ButtonHi,
Is there an easy way to not show the Next button on certain steps of the wizard? -- Thanks Morris Hi Morris,
Based on my understanding, you want to hide default Next Button in Wizard control's step. If I have misunderstood you, please feel free to let me know. There are a couple of ways to set Next Button's Visible. One is using Wizard control's templates; another is programmatically locate the button and set its property. ##Using Wizard control's templates: Wizard control contains templates that allow you to customize the look and feel. We can convert the steps to StartNavigationTemplate, StepNavigationTemplate, FinishNavigationTemplate, etc. If we do so, we can set Next Button's Visible property in HTML markup. For example, I want to hide the Next Button in first step. 1. Drag and drop a Wizard control to page 2. Right click this Wizard control and select "Convert to StartNavigationTemplate" 3. Enter this page's markup Source view and set Visible property to false of Button named "StartNextButton" in startnavigationtemplate. ##Set Next Button's property programmatically: We can set Next Button's property at runtime. To do so, we need to get its instance firstly. The following example is set Next Button's property at runtime: ============================= <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void btnShow1_Click(object sender, EventArgs e) { //Based on Wizard control's hierarchy, "StartNavigationTemplateContainerID$StartNextButton" is the UniqueID of Next Button within startnavigationtemplate. Button btn = (Button)Wizard1.FindControl("StartNavigationTemplateContainerID$StartNextBut ton"); btn.Visible = true; } protected void btnHideButton_Click(object sender, EventArgs e) { //Based on Wizard control's hierarchy, "StepNavigationTemplateContainerID$StartNextButton" is the UniqueID of Next Button within stepnavigationtemplate. Button btn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepNextButto n"); btn.Visible = false; } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:wizard ID="Wizard1" runat="server" ActiveStepIndex="0"> <wizardsteps> <asp:wizardstep runat="server" Title="Step 1"> <asp:button ID="btnShow1" runat="server" OnClick="btnShow1_Click" Text="Show NextButton In Step1" /> </asp:wizardstep> <asp:wizardstep runat="server" Title="Step 2"> <asp:button ID="btnHideButton" runat="server" OnClick="btnHideButton_Click" Text="Hide Next Button" /> </asp:wizardstep> <asp:wizardstep runat="server" Title="Step 3"> </asp:wizardstep> </wizardsteps> <startnavigationtemplate> <asp:button ID="StartNextButton" runat="server" CommandName="MoveNext" Text="Next" Visible="false" /> </startnavigationtemplate> <stepnavigationtemplate> <asp:button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" /> <asp:button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" /> </stepnavigationtemplate> </asp:wizard> </div> </form> </body> </html> ========================== For more information about Wizard Templates, see http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/standard/wizard. aspx I look forward to receiving your test results. -- Show quoteHide quoteBest Regards, Thomas Sun Microsoft Online Partner Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed to the limited number of phone-based technical support incidents. Complex issues or server-down situations are not recommended for the newsgroups. Issues of this nature are best handled working with a Microsoft Support Engineer using one of your phone-based incidents. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols > >Hi, > >Is there an easy way to not show the Next button on certain steps of the >wizard? >-- >Thanks >Morris > Thanks. I used the Wizard control template and was able to hide the Next
control. Is there a way to make the Next button not show only on a specific step but show on other steps? -- Show quoteHide quoteThanks Morris "Thomas Sun [MSFT]" wrote: > Hi Morris, > > Based on my understanding, you want to hide default Next Button in Wizard > control's step. If I have misunderstood you, please feel free to let me > know. > > There are a couple of ways to set Next Button's Visible. One is using > Wizard control's templates; another is programmatically locate the button > and set its property. > > ##Using Wizard control's templates: > Wizard control contains templates that allow you to customize the look and > feel. We can convert the steps to StartNavigationTemplate, > StepNavigationTemplate, FinishNavigationTemplate, etc. If we do so, we can > set Next Button's Visible property in HTML markup. > > For example, I want to hide the Next Button in first step. > 1. Drag and drop a Wizard control to page > 2. Right click this Wizard control and select "Convert to > StartNavigationTemplate" > 3. Enter this page's markup Source view and set Visible property to false > of Button named "StartNextButton" in startnavigationtemplate. > > ##Set Next Button's property programmatically: > We can set Next Button's property at runtime. To do so, we need to get its > instance firstly. > > The following example is set Next Button's property at runtime: > ============================= > <%@ Page Language="C#" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <script runat="server"> > > protected void btnShow1_Click(object sender, EventArgs e) > { > //Based on Wizard control's hierarchy, > "StartNavigationTemplateContainerID$StartNextButton" is the UniqueID of > Next Button within startnavigationtemplate. > Button btn = > (Button)Wizard1.FindControl("StartNavigationTemplateContainerID$StartNextBut > ton"); > btn.Visible = true; > > } > > protected void btnHideButton_Click(object sender, EventArgs e) > { > //Based on Wizard control's hierarchy, > "StepNavigationTemplateContainerID$StartNextButton" is the UniqueID of Next > Button within stepnavigationtemplate. > Button btn = > (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepNextButto > n"); > btn.Visible = false; > } > </script> > > <html xmlns="http://www.w3.org/1999/xhtml"> > <head runat="server"> > <title>Untitled Page</title> > </head> > <body> > <form id="form1" runat="server"> > <div> > <asp:wizard ID="Wizard1" runat="server" ActiveStepIndex="0"> > <wizardsteps> > <asp:wizardstep runat="server" Title="Step 1"> > <asp:button ID="btnShow1" runat="server" > OnClick="btnShow1_Click" Text="Show NextButton In Step1" /> > </asp:wizardstep> > <asp:wizardstep runat="server" Title="Step 2"> > <asp:button ID="btnHideButton" runat="server" > OnClick="btnHideButton_Click" Text="Hide Next Button" /> > </asp:wizardstep> > <asp:wizardstep runat="server" Title="Step 3"> > </asp:wizardstep> > </wizardsteps> > <startnavigationtemplate> > <asp:button ID="StartNextButton" runat="server" > CommandName="MoveNext" Text="Next" Visible="false" /> > </startnavigationtemplate> > <stepnavigationtemplate> > <asp:button ID="StepPreviousButton" runat="server" > CausesValidation="False" CommandName="MovePrevious" > Text="Previous" /> > <asp:button ID="StepNextButton" runat="server" > CommandName="MoveNext" Text="Next" /> > </stepnavigationtemplate> > </asp:wizard> > </div> > </form> > </body> > </html> > ========================== > > For more information about Wizard Templates, see > http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/standard/wizard. > aspx > > > I look forward to receiving your test results. > > > > -- > Best Regards, > Thomas Sun > > Microsoft Online Partner Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications. > > With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed > to the limited number of phone-based technical support incidents. Complex > issues or server-down situations are not recommended for the newsgroups. > Issues of this nature are best handled working with a Microsoft Support > Engineer using one of your phone-based incidents. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > -------------------- > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols > > > >Hi, > > > >Is there an easy way to not show the Next button on certain steps of the > >wizard? > >-- > >Thanks > >Morris > > > > Hi Morris,
> Thanks for your response.>Thanks. I used the Wizard control template and was able to hide the Next >control. > >Is there a way to make the Next button not show only on a specific step but >show on other steps? >-- >Thanks >Morris > > As mentioned in my first post, we can set Next Button's Visible in Wizard control's templates and programmatically locate the button. ## Set specific step's Next button Visible in Wizard's template If we use Wizard control template and set Next button's Visible false, all the Next buttons in this template will be hided. If we want to only hide Next button on specified step, we can move Next button from template to step's content. For example, there is wizard control with four steps and we try to hide Next button in step 3. The step 3 is stepnavigationtemplate so we just need convert it to stepnavigationtemplate. The follow is the step: 1.Drag and drop a Wizard control to page 2.Right click this Wizard control and select "Convert to StepNavigationTemplate" 3.Enter this page's markup Source view and copy stepnavigationtemplate's contents to step2 and step3. 4.Set Next button's Visible false in step3. 5.Delete stepnavigationtemplate's contents. Then, we will get something like following: ============= <asp:wizard ID="Wizard1" runat="server" ActiveStepIndex="0"> <wizardsteps> <asp:wizardstep runat="server" Title="Step 1"> Step 1</asp:wizardstep> <asp:wizardstep runat="server" Title="Step 2"> Step 2<br /> <asp:button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" /> <asp:button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" /> </asp:wizardstep> <asp:wizardstep runat="server" Title="Step3"> Step 3<br /> <asp:button ID="Button1" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" /> <asp:button ID="Button2" runat="server" CommandName="MoveNext" Text="Next" Visible="False" /> </asp:wizardstep> <asp:wizardstep runat="server" Title="Step4"> Step 4</asp:wizardstep> </wizardsteps> <stepnavigationtemplate> </stepnavigationtemplate> </asp:wizard> ================ Note: Please make sure the button's CommandName is right. Wizard control uses the CommandName to handle Previous and Next button click event. ## Set specific step's Next button Visible property programmatically We also can change Next button's Visible in Wizard's OnNextButtonClick or OnSideBarButtonClick event for specified step. For example, we try to hide step3's Next Button: =============== <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Wizard2_NextButtonClick(object sender, WizardNavigationEventArgs e) { //Set step3 Next button's Visible false if (e.NextStepIndex == 2) { Button btn = (Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButto n"); btn.Visible = false; } } protected void btnShow1_Click(object sender, EventArgs e) { //Based on Wizard control's hierarchy, "StepNavigationTemplateContainerID$StartNextButton" is the UniqueID of Next Button within stepnavigationtemplate. Button btn = (Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButto n"); btn.Visible = true; } protected void Wizard2_PreviousButtonClick(object sender, WizardNavigationEventArgs e) { if (e.CurrentStepIndex == 2) { Button btn = (Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButto n"); btn.Visible = true; } } protected void Wizard2_SideBarButtonClick(object sender, WizardNavigationEventArgs e) { //Set step3 Next button's Visible false if (e.NextStepIndex == 2) { Button btn = (Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButto n"); btn.Visible = false; } } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:wizard ID="Wizard2" runat="server" ActiveStepIndex="0" OnNextButtonClick="Wizard2_NextButtonClick" OnPreviousButtonClick="Wizard2_PreviousButtonClick" OnSideBarButtonClick="Wizard2_SideBarButtonClick"> <wizardsteps> <asp:wizardstep runat="server" Title="Step 1"> Step 1</asp:wizardstep> <asp:wizardstep runat="server" Title="Step 2"> Step 2<br /> </asp:wizardstep> <asp:wizardstep runat="server" Title="Step3"> Step 3<br /> <asp:button ID="btnShow1" runat="server" OnClick="btnShow1_Click" Text="Show NextButton In Step 3" /> </asp:wizardstep> <asp:wizardstep runat="server" Title="Step4"> Step 4</asp:wizardstep> </wizardsteps> <stepnavigationtemplate> <asp:button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" /> <asp:button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" /> </stepnavigationtemplate> </asp:wizard> </div> </form> </body> </html> ============== I look forward to receiving your test results. -- Best Regards, Thomas Sun Microsoft Online Partner Support Hi Morris,
I wanted to see if the information provided was helpful. Please keep us posted on your progress and let us know if you have any additional questions or concerns. I am looking forward to your response. -- Best Regards, Thomas Sun Microsoft Online Partner Support -------------------- >X-Tomcat-ID: 38951825 <jqykukJxJHA.5***@TK2MSFTNGHUB02.phx.gbl> >References: <C03BAE4F-56C8-49C7-BB22-F43B1E925***@microsoft.com> <9E823692-F261-4629-9147-C8390AC7E***@microsoft.com> >MIME-Version: 1.0 microsoft.public.dotnet.framework.aspnet.webcontrols:4667>Content-Type: text/plain >Content-Transfer-Encoding: 7bit >From: v-th***@online.microsoft.com (Thomas Sun [MSFT]) >Organization: Microsoft >Date: Tue, 28 Apr 2009 06:41:22 GMT >Subject: RE: Wizard Next Button >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols >Message-ID: <76b2dx8xJHA.2***@TK2MSFTNGHUB02.phx.gbl> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols >Lines: 162 >Path: TK2MSFTNGHUB02.phx.gbl >Xref: TK2MSFTNGHUB02.phx.gbl Show quoteHide quote >NNTP-Posting-Host: tk2tomimport1.phx.gbl 10.230.18.247 > >Hi Morris, > >> >>Thanks. I used the Wizard control template and was able to hide the Next >>control. >> >>Is there a way to make the Next button not show only on a specific step >but >>show on other steps? >>-- >>Thanks >>Morris >> >> > >Thanks for your response. > >As mentioned in my first post, we can set Next Button's Visible in Wizard >control's templates and programmatically locate the button. > >## Set specific step's Next button Visible in Wizard's template > >If we use Wizard control template and set Next button's Visible false, all >the Next buttons in this template will be hided. If we want to only hide >Next button on specified step, we can move Next button from template to >step's content. > >For example, there is wizard control with four steps and we try to hide >Next button in step 3. The step 3 is stepnavigationtemplate so we just need >convert it to stepnavigationtemplate. The follow is the step: >1.Drag and drop a Wizard control to page >2.Right click this Wizard control and select "Convert to > StepNavigationTemplate" >3.Enter this page's markup Source view and copy stepnavigationtemplate's >contents to step2 and step3. >4.Set Next button's Visible false in step3. >5.Delete stepnavigationtemplate's contents. > >Then, we will get something like following: >============= > <asp:wizard ID="Wizard1" runat="server" ActiveStepIndex="0"> > <wizardsteps> > <asp:wizardstep runat="server" Title="Step 1"> > Step 1</asp:wizardstep> > <asp:wizardstep runat="server" Title="Step 2"> > Step 2<br /> > <asp:button ID="StepPreviousButton" runat="server" >CausesValidation="False" CommandName="MovePrevious" > Text="Previous" /> > <asp:button ID="StepNextButton" runat="server" >CommandName="MoveNext" Text="Next" /> > </asp:wizardstep> > <asp:wizardstep runat="server" Title="Step3"> > Step 3<br /> > <asp:button ID="Button1" runat="server" >CausesValidation="False" CommandName="MovePrevious" > Text="Previous" /> > <asp:button ID="Button2" runat="server" >CommandName="MoveNext" Text="Next" Visible="False" /> > </asp:wizardstep> > <asp:wizardstep runat="server" Title="Step4"> > Step 4</asp:wizardstep> > </wizardsteps> > <stepnavigationtemplate> > </stepnavigationtemplate> > </asp:wizard> >================ >Note: Please make sure the button's CommandName is right. Wizard control >uses the CommandName to handle Previous and Next button click event. > >## Set specific step's Next button Visible property programmatically >We also can change Next button's Visible in Wizard's OnNextButtonClick or >OnSideBarButtonClick event for specified step. > >For example, we try to hide step3's Next Button: >=============== ><%@ Page Language="C#" %> > ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > ><script runat="server"> > > > protected void Wizard2_NextButtonClick(object sender, >WizardNavigationEventArgs e) > { > //Set step3 Next button's Visible false > if (e.NextStepIndex == 2) > { > Button btn = >(Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButt o >n"); > btn.Visible = false; > } > > } > > protected void btnShow1_Click(object sender, EventArgs e) > { > //Based on Wizard control's hierarchy, >"StepNavigationTemplateContainerID$StartNextButton" is the UniqueID of Next >Button within stepnavigationtemplate. > Button btn = >(Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButt o >n"); > btn.Visible = true; > } > > protected void Wizard2_PreviousButtonClick(object sender, >WizardNavigationEventArgs e) > { > if (e.CurrentStepIndex == 2) > { > Button btn = >(Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButt o >n"); > btn.Visible = true; > } > } > > protected void Wizard2_SideBarButtonClick(object sender, >WizardNavigationEventArgs e) > { > //Set step3 Next button's Visible false > if (e.NextStepIndex == 2) > { > Button btn = >(Button)Wizard2.FindControl("StepNavigationTemplateContainerID$StepNextButt o >n"); > btn.Visible = false; > } > } ></script> > ><html xmlns="http://www.w3.org/1999/xhtml"> ><head runat="server"> > <title>Untitled Page</title> ></head> ><body> > <form id="form1" runat="server"> > <div> > <asp:wizard ID="Wizard2" runat="server" ActiveStepIndex="0" >OnNextButtonClick="Wizard2_NextButtonClick" >OnPreviousButtonClick="Wizard2_PreviousButtonClick" >OnSideBarButtonClick="Wizard2_SideBarButtonClick"> > <wizardsteps> > <asp:wizardstep runat="server" Title="Step 1"> > Step 1</asp:wizardstep> > <asp:wizardstep runat="server" Title="Step 2"> > Step 2<br /> > > </asp:wizardstep> > <asp:wizardstep runat="server" Title="Step3"> > Step 3<br /> > <asp:button ID="btnShow1" runat="server" >OnClick="btnShow1_Click" Text="Show NextButton In Step 3" /> > </asp:wizardstep> > <asp:wizardstep runat="server" Title="Step4"> > Step 4</asp:wizardstep> > </wizardsteps> > <stepnavigationtemplate> > <asp:button ID="StepPreviousButton" runat="server" >CausesValidation="False" CommandName="MovePrevious" > Text="Previous" /> > <asp:button ID="StepNextButton" runat="server" >CommandName="MoveNext" Text="Next" /> > </stepnavigationtemplate> > </asp:wizard> > </div> > </form> ></body> ></html> >============== > > >I look forward to receiving your test results. > > >-- >Best Regards, >Thomas Sun > >Microsoft Online Partner Support > > > >
Other interesting topics
Best practice ASP SQL
Specifying property defaults Wizard Control - Issue 2 Wizard Control how to pass the current user with reportviewer control viewing xml ASP.NET equivelant for include files that won't cause problems Control is not showing inherited properties in property grid Programmatically add textbox control with incrementing id Is here a web control to create tasks/calendars in Outlook ? |
|||||||||||||||||||||||