Hi, I have created a two dynamic control & added in placeholder one by one. But I doesn't able to set its according to need.
Color Size Material MadeIn Blue Red Green, Yellow Black Violet 38 40 42 44 46 XL XS 3XL L Cotton Synthetic Nylon USA UK INDIA France Germany UAE
But I want Output Like This :
Color : Blue Red Green, Yellow Black Violet Size : 38 40 42 44 46 XL XS 3XL L Material : Cotton Synthetic Nylon MadeIn : USA UK INDIA France Germany UAE
private void bind_chk() { string queries = "select distinct varient from tbl_ProductVariety_Value"; SqlDataAdapter da = new SqlDataAdapter(queries, new CommonClass().connection()); DataTable data = new DataTable(); da.Fill(data); if (data.Rows.Count > 0) { for (int im = 0; im < data.Rows.Count; im++) { string query = "select prd_vrtyvalue_id,varient_value from tbl_ProductVariety_Value where varient='" + data.Rows[im]["varient"].ToString() + "' " + " order by varient_value asc "; DataTable abc = new DataTable(); SqlDataAdapter ada = new SqlDataAdapter(query, new CommonClass().connection()); ada.Fill(abc); Label lbl = new Label(); lbl.Text = data.Rows[im]["varient"].ToString() + "<br/><br/>"; lbl.ForeColor = System.Drawing.Color.Blue; PlaceHolder2.Controls.Add(lbl); Label1.Text = data.Rows[im]["varient"].ToString(); CheckBoxList ChkboxList = new CheckBoxList(); ChkboxList.ID = "Chkbox"+im; for (int i = 0; i < abc.Rows.Count; i++) { ChkboxList.Items.Add(new ListItem(abc.Rows[i]["varient_value"].ToString(), abc.Rows[i]["prd_vrtyvalue_id"].ToString())); } ChkboxList.RepeatColumns = 3; PlaceHolder1.Controls.Add(ChkboxList); Response.Write(""); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "error", "alert('0 result found '" + Label1.Text + "' !');", true); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)