0

I placed a dropdownlist in the content placeholder entitled cpmainwrapper . I then placed a detailsview congtrol beneath it and wanted to use float:left to have them render side by side. After failing, I checked the code on the browser and see that the detailsview is being placed in its own div. How can I make them show side by side?

steg
  • 21
  • 2
  • 3
    Easier to help you if you show the code, but it sounds to me like you could achieve that with CSS. – Mario S Aug 18 '13 at 21:25
  • Does the page have the DIV in the markup? In Visual Studio when you use "Add New WebForm" dialog, by default it adds a Div to page markup. – Yuriy Galanter Aug 18 '13 at 23:56

1 Answers1

0

Try setting the css float on the DetailsView as well as the DropDownList.

Either in the head of your page markup or in a seperate CSS include file;

<style type="text/css">
  .ddlStyle
  {
    float: left;
  }
  .dvStyle 
  {
    float: left;
  }
</style>

And (although greatly simplified) in your ASPX page;

    <asp:DropDownList ID="ddl1" CssClass="ddlStyle" runat="server">
    </asp:DropDownList>
    <asp:DetailsView ID="dv1" CssClass="dvStyle" runat="server">
    </asp:DetailsView>

Depending on the browser(s) you are targetting you could consider using inline-block instead of float on the DetailsView;

.dvStyle 
{
    display: inline-block;
}

If you are targetting multiple browsers, it would be prudent of me to warn you to test the CSS across browsers and note that IE can do strange things with floats: What is a clearfix?

Community
  • 1
  • 1
Darren S
  • 920
  • 5
  • 15