I am making web application using Asp.net C#(Visual Studio2005).
I have checkboxlist(which is populated by all the master filed like category , subcategory ,customer , etc ). Now based on selection I generates web control label (to name the field) and dropdownlistbox (which is filled by code and its description).
My problem is all controls comes one after other. I would like label then dropdownlist in a single line. That custlabel and its dropdownlist comes in one line then next say categorylabel and its dropdownlistbox should align in next line and inbetween them one free line .
My code is
foreach (ListItem li in CheckBoxListmst.Items)
if (li.Selected == true)
//code added to fetch dropdownlist
setting = ConfigurationManager.ConnectionStrings["StyleSearchConnectionString"];
if (setting != null)
conn = new SqlConnection(setting.ConnectionString);
cmd = new SqlCommand("Search_display");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters["@cateid"].Value = li.Text.ToString();
cmd.Connection = conn;
// added controls
Label label = new Label();
DropDownList dropdownlist = new DropDownList();
label.ID = "label" + li.Text;
dropdownlist.ID = "dropdownlist" + li.Text;
label.Text = li.Text;
rdr = cmd.ExecuteReader();
ListItem ld = new ListItem();
ld.Text = rdr["disp"].ToString();
ld.Value = rdr["mstid"].ToString();
//added controls end
catch (SqlException ex)
Please Guide me or atleast give some help full link.