Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在顶部而不是侧面显示asp.net向导控件侧栏_C#_Asp.net_Wizard - Fatal编程技术网

C# 在顶部而不是侧面显示asp.net向导控件侧栏

C# 在顶部而不是侧面显示asp.net向导控件侧栏,c#,asp.net,wizard,C#,Asp.net,Wizard,目前,我以编程方式创建了一个向导及其步骤,并尝试在顶部而不是侧面显示默认的侧栏及其指向每个步骤的链接。这可能吗 Wizard wiz = new Wizard(); //Do stuff with wizard steps 使用CSS是可能的 ASP.NET声明性代码 <asp:Wizard ID="ApplicationWizard" runat="server" DisplaySideBar="True"> <%-- LAYOUT --%>

目前,我以编程方式创建了一个向导及其步骤,并尝试在顶部而不是侧面显示默认的侧栏及其指向每个步骤的链接。这可能吗

Wizard wiz = new Wizard();
//Do stuff with wizard steps
使用CSS是可能的

ASP.NET声明性代码

    <asp:Wizard ID="ApplicationWizard" runat="server" DisplaySideBar="True">
        <%-- LAYOUT --%>
        <LayoutTemplate>
            <div>
                <asp:PlaceHolder ID="headerPlaceHolder" runat="server" />
            </div>
            <div id="stepIndicator">
                <asp:PlaceHolder ID="sideBarPlaceHolder" runat="server" />
            </div>
            <div>
                <asp:PlaceHolder ID="WizardStepPlaceHolder" runat="server" />
            </div>
            <div>
                <asp:PlaceHolder ID="navigationPlaceHolder" runat="server" />
            </div>
        </LayoutTemplate>

        <%-- HEADER --%>
        <HeaderTemplate>
            <h1 class="text-center">My Form</h1>
            <%-- TODO: Add your header elements here --%>
        </HeaderTemplate>

        <%-- SIDEBAR --%>
        <SideBarTemplate>
            <ul id="header">
                <asp:ListView ID="SideBarList" runat="server">
                    <ItemTemplate>
                        <li><asp:LinkButton ID="sideBarButton" runat="server" /></li>
                    </ItemTemplate>
                    <SelectedItemTemplate>
                        <li><asp:LinkButton ID="sideBarButton" runat="server" CssClass="active-step" /></li>
                    </SelectedItemTemplate>
                </asp:ListView>
            </ul>
        </SideBarTemplate>

        <%-- Wizard Steps --%>
        <WizardSteps>
            <asp:TemplatedWizardStep ID="AppStep1" runat="server" Title="Step 1">
                <ContentTemplate>
                    <%-- TODO: Add your wizard step elements here --%>
                </ContentTemplate>
            </asp:TemplatedWizardStep>

            <asp:TemplatedWizardStep ID="AppStep2" runat="server" Title="Step 2">
                <ContentTemplate></ContentTemplate>
            </asp:TemplatedWizardStep>

            <asp:TemplatedWizardStep ID="AppStep3" runat="server" Title="Step 3">
                <ContentTemplate></ContentTemplate>
            </asp:TemplatedWizardStep>

            <asp:TemplatedWizardStep ID="AppStep4" runat="server" Title="Step 4">
                <ContentTemplate></ContentTemplate>
            </asp:TemplatedWizardStep>

            <asp:TemplatedWizardStep ID="AppStep5" runat="server" Title="Step 5">
                <ContentTemplate></ContentTemplate>
            </asp:TemplatedWizardStep>
        </WizardSteps>
    </asp:Wizard>
但是怎么办呢?:

  • 在侧栏模板上,创建一个列表元素
  • 在嵌套的列表中插入所需的链接按钮
  • 输出将是默认格式(侧边栏)
  • #步进指示器添加
    文本对齐:居中
    ,使侧边栏居中
  • #步进指示器li
    添加
    显示:内联块
    ,以对齐
    #步进指示器
    内联的元素
  • #stepIndicator {
        list-style: none;
        margin: 0px;
        padding: 0px;
        text-align: center;
    }
    
    #stepIndicator li {
        display: inline-block;
    }
    
    #stepIndicator li a {
        text-decoration: none;
        padding: 10px;
        display: block;
    }