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
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:
Page.Form.Controls.Add(ddl);
ddl.DropDownLayout.DropdownHeight = System.Web.UI.WebControls.Unit.Empty;
Example: This does not:
ddl.DropDownLayout.DropdownWidth = System.Web.UI.WebControls.Unit.Empty;
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
Thank you for your help.
It worked.