I am adding multiple dynamic controls to my webform, I know how to position individual controls but how do you position multiple controls. For e.g. I have a Dropdownlist where the user selects the amount of controls to be added to the webform, I then create the amount of controls based on the selection, for instance 5 dropdownlists, I could I position them one after the other.
Below is one created with an absolute position.
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For i As Integer = 0 To ddlFieldNames.SelectedIndex
Dim combo As New RadComboBox()
combo.Style("Position") = "Absolute"
combo.Style("Top") = "10px"
combo.Style("Left") = "200px"
Me.Panel1.Controls.Add(combo)
combo.ID = "combo" + i.ToString()
combo.DataSource = Me.odsField
combo.DataTextField = "FieldNames"
combo.DataValueField = "FieldNames"
combo.DataBind()
Next
End Sub
Try keeping Panel1 style as relative and then combo boxes will get absolutely positioned per panel coordinates.
Also, instead of assigning css properties in the code, create a css class and assign it so that you can change the positioning without code compilation.
Did you also try placing combobox in div’s, which automatically introduces new line for each combo box.