开发者

How to make <asp:Menu and <asp:DropDownList on one line?

I've tried this :

  <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:M开发者_如何学PythonenuItem 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>

but it puts DropDownList not to the end of line , it puts it on a new line.


You need to a simple Css Class as follows:

.Menu
{
    display: inline-block;
}

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

Update

<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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜