Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
176
Autosizing in dropdownlayout issue
posted

First of all i am trying to make my webcombo look like a dropdownlist.

WebCombo ddl = new WebCombo();
ddl.DropDownLayout.ColHeadersVisible = Infragistics.WebUI.UltraWebGrid.ShowMarginInfo.No;
ddl.DropDownLayout.RowSelectors = Infragistics.WebUI.UltraWebGrid.RowSelectors.No;
ddl.DropDownLayout.GridLines = Infragistics.WebUI.UltraWebGrid.UltraGridLines.None;

then i want the dropdown layout to autosize width and height, because the content is dynamic.

ddl.DropDownLayout.DropdownWidth = System.Web.UI.WebControls.Unit.Empty;
ddl.DropDownLayout.DropdownHeight = System.Web.UI.WebControls.Unit.Empty;
ddl.DropDownLayout.TableLayout = Infragistics.WebUI.UltraWebGrid.TableLayout.Auto;

then for testing

ddl.DataSource = someDataTable;
ddl.DataBind();
contentplaceholder.controls.add(ddl);

The problem is that the DropdownList is still fixed width and height. Is doesn't autosize smaller or bigger.
Anyone have a solution for this or see any mistake i have made in my code?

I am using  version 7.3

 

 

 

 

  • 236
    Verified Answer
    posted

    I have no idea why this is the case but it is the order in which you are doing things. 

    You must add the control to the container BEFORE setting the height and width of the dropdownlayout:

     Example:  This works:

    WebCombo ddl = new WebCombo();

    Page.Form.Controls.Add(ddl);

    ddl.DropDownLayout.DropdownWidth = System.Web.UI.WebControls.
    Unit.Empty;

    ddl.DropDownLayout.DropdownHeight = System.Web.UI.WebControls.Unit.Empty;

     

    Example: This does not:

    WebCombo ddl = new WebCombo();

    ddl.DropDownLayout.DropdownWidth = System.Web.UI.WebControls.Unit.Empty;

    ddl.DropDownLayout.DropdownHeight = System.Web.UI.WebControls.Unit.Empty;

    Page.Form.Controls.Add(ddl);

     

    so be sure to add the control to the container before setting height and width, i find it easiest to add to container right after declaration.

     

    Adam