c# - How can I display two asp:Panel controls side by side? -
i have 2 panels. want show them abreast, don't.
.aspx:
<asp:panel id="treeviewmenu" width="20%" height="500" runat="server" scrollbars="both" horizontalalign="left"> <asp:treeview id="treeview" runat="server" showlines="true" imageset="xpfileexplorer" onselectednodechanged="treeview_selectednodechanged"> </asp:treeview> </asp:panel> <asp:panel id="qvobjektmenu" width="75%" height="500" runat="server" horizontalalign="right"> <asp:table runat="server" horizontalalign="right"> <asp:tablerow> <asp:tablecell> <asp:label runat="server"> qvobjekt id: </asp:label> </asp:tablecell> <asp:tablecell> <asp:label id="qvobjektid" runat="server"></asp:label> </asp:tablecell> </asp:tablerow> </asp:table> </asp:panel>
i have used table outside 2 elements, panel around them, nothing works. how can resolve this?
the answer here css. there few options how in css.
option 1: display:inline-block;
one option css use display: inline-block;
:
<style type="text/css"> .inlineblock { display: inline-block; } </style>
coupled setting in <asp:panel ...>
tags:
<asp:panel id="treeviewmenu" ... cssclass="inlineblock"> ... </asp:panel> <asp:panel id="qvobjektmenu" ... cssclass="inlineblock"> ... </asp:panel>
option 2a: float:left;
another option, mentioned in wim's answer use floats. not think want combine both panels have floats -- suspect want 1 or other. either:
<style type="text/css"> .floatleft { float: left; } </style>
and
<asp:panel id="treeviewmenu" ... cssclass="floatleft"> <asp:treeview id="treeview" runat="server" showlines="true" imageset="xpfileexplorer" > </asp:treeview> </asp:panel>
(with other panel in markup)
or
option 2b: float:right;
<style type="text/css"> .floatright { float: right; } </style>
and
<asp:panel id="qvobjektmenu" ... cssclass="floatright"> ... </asp:panel>
Comments
Post a Comment