2010-03-23 14 views
2

我已經試過這樣:如何在一行上製作<asp:Menu和<asp:DropDownList?

<div id="xDiv" align="left"> 
     <div id="divX" runat="server" style="margin-left:40px; width: 650px;" 
      align="center"> 
    <asp:Menu ID="Menu3" runat="server" Orientation="Horizontal" Width="100%" 
         StaticSelectedStyle-CssClass="StaticSelectedStyle" Height="52px" 
         StaticSubMenuIndent="18px" oninit="Menu3_Init"> 
    <StaticSelectedStyle CssClass="StaticSelectedStyle"></StaticSelectedStyle> 
    <Items> 
     <asp:MenuItem Text="Test" /> 
    </Items> 
    </asp:Menu> 
    </div> 
    <div runat="server"> 
     <asp:DropDownList ID="DropDownList3" runat="server" 
      DataSourceID="SqlDataSource1" DataTextField="RepGroup_Name" 
      DataValueField="RepGroup_ID" Width="162px"> 
     </asp:DropDownList> 
    </div> 
    </div> 

但是卻讓DropDownList的不是線的末端,它把它放在一個新行。

回答

4

你需要一個簡單的CSS類如下:

.Menu 
{ 
    display: inline-block; 
} 

<asp:Menu ID="Menu1" runat="server" CssClass="Menu" /> 
<asp:DropDownList ID="DropDownList1" runat="server" /> 

更新

<div id="xDiv" align="left"> 
    <div id="divX" runat="server" style="margin-left: 40px; width: 650px; float: left;" align="center"> 
     <asp:Menu ID="Menu3" runat="server" Orientation="Horizontal" Width="100%" StaticSelectedStyle-CssClass="StaticSelectedStyle" 
      Height="52px" StaticSubMenuIndent="18px"> 
      <StaticSelectedStyle CssClass="StaticSelectedStyle"></StaticSelectedStyle> 
      <Items> 
       <asp:MenuItem Text="Test" /> 
      </Items> 
     </asp:Menu> 
    </div> 
    <div id="Div1" runat="server" style="float: left;"> 
     <asp:DropDownList ID="DropDownList3" runat="server" Width="162px"> 
      <asp:ListItem Text="Item1" Value="Item1" /> 
     </asp:DropDownList> 
    </div> 
</div> 
+0

哦...謝謝^ _ – Cynede 2010-03-23 09:22:14

+0

但它沒有任何意義> ___ < – Cynede 2010-03-23 10:20:45

+0

嘗試更新.......... – Cynede 2010-03-23 10:44:10

相關問題