本文介绍了根据单选按钮的选择将开始向导作为完成向导的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

使用向导控件时出现问题:

说明:我有一个只有2个步骤的向导控件,在第一步中,我有一个基于单选按钮选择的单选按钮列表(如果选择索引== 1),那么我需要显示向导步骤2,否则我需要完成向导在第1步.

我该怎么办.

Hi All,

I have an issue using wizard control:

Explanation: I have a wizard control with only 2 steps, in first step I have one radio button list based on the radiobutton selection ( if the selection index==1) then I need to show wizard step 2 else I need to finish the wizard at step 1.

How can I do this.

<asp:Wizard ID="Wizard1" runat="server" OnFinishButtonClick="Wizard1_FinishButtonClick"
         OnNextButtonClick="Wizard1_NextButtonClick" ActiveStepIndex="0">
         <StepStyle Width="20%" />
         <FinishNavigationTemplate>
             <asp:Button ID="FinishPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
                 Text="Previous wizard" />
             <asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" Text="Finish wizard"></asp:Button>

         </FinishNavigationTemplate>
         <HeaderTemplate>
             
                 <%=Wizard1.ActiveStep.Title %>
             <br />
             <br />
         </HeaderTemplate>
         <StartNavigationTemplate>
             <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext"
                 Text="Next wizard" />
                   <asp:Button ID="FinishButton1" Visible="false" runat="server" CommandName="MoveComplete" Text="Finish wizard"></asp:Button>
         </StartNavigationTemplate>
         <WizardSteps>
             <asp:WizardStep ID="WizardStep1" runat="server" Title="step1" steptype="auto" >
                 <table cellpadding="2" cellspacing="2">
                     <tr>
                         <td>
                             First Name :
                         </td>
                         <td>
                             <asp:TextBox ID="FirstNameTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             Last Name :
                         </td>
                         <td>
                             <asp:TextBox ID="LastNameTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             DOB :
                         </td>
                         <td>
                             <asp:TextBox ID="DOBTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             Website URL :
                         </td>
                         <td>
                             <asp:TextBox ID="WebsiteURLTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr >
                     <td colspan="2">
                     <asp:RadioButtonList ID="rdlList" runat="server" AutoPostBack="true"
                             OnSelectedIndexChanged="rdlList_SelectedIndexChanged1">
                      <asp:ListItem>Andaman and Nicobar Islands</asp:ListItem>
                                 <asp:ListItem>Andhra Pradesh</asp:ListItem>
                     </asp:RadioButtonList>
                     </td>
                     </tr>
                 </table>
             </asp:WizardStep>
             <asp:WizardStep ID="WizardStep2" runat="server" Title="step2">
                 <table cellpadding="2" cellspacing="2">
                     <tr>
                         <td>
                             City :
                         </td>
                         <td>
                             <asp:TextBox ID="CityTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             State :
                         </td>
                         <td>
                             <asp:TextBox ID="StateTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             Country :
                         </td>
                         <td>
                             <asp:TextBox ID="CountryTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             Zip :
                         </td>
                         <td>
                             <asp:TextBox ID="ZipTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             Phone :
                         </td>
                         <td>
                             <asp:TextBox ID="PhoneTextBox" runat="server" Width="240px"></asp:TextBox>
                         </td>
                     </tr>
                 </table>
             </asp:WizardStep>
             <asp:WizardStep ID="WizardStep3" runat="server" Title="step3">
                 <table cellpadding="0" cellspacing="0" class="style1">
                     <tr>
                         <td>
                              </td>
                         <td>
                             <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                         </td>
                     </tr>
                     <tr>
                         <td>
                              </td>
                         <td>
                             <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                         </td>
                     </tr>
                 </table>
             </asp:WizardStep>
         </WizardSteps>
         <StepNavigationTemplate>
             <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False"
                 CommandName="MovePrevious" Text="Previouswizard" />
             <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext"
                 Text="Nextwizard" />
         </StepNavigationTemplate>
     </asp:Wizard>


还有


And

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{

}
protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
{

}
protected void rdlList_SelectedIndexChanged1(object sender, EventArgs e)
{
    if (rdlList.SelectedIndex == 0)
    {

    }
    else if (rdlList.SelectedIndex == 1)
    {
        ((Button)Wizard1.FindControl("StartNavigationTemplateContainerID$StartNextButton").FindControl("StartNextButton")).Visible = false;
        ((Button)Wizard1.FindControl("StartNavigationTemplateContainerID$FinishButton1").FindControl("FinishButton1")).Visible = true;

    }
}


请帮助某人解决此问题.

-Sindhu.A


Please help some one to solve this.

-Sindhu.A

推荐答案



请帮助某人解决此问题.

-Sindhu.A


Please help some one to solve this.

-Sindhu.A



这篇关于根据单选按钮的选择将开始向导作为完成向导的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 23:45