I have a code : public DataTable Select_Category() { dt_category = ds.GetTable("SELECT * FROM itc_category"); DataTable ndt = new DataTable(); ndt.Columns.Add("id"); ndt.Columns.Add("Cat Name"); for (int i = 0; i < dt_category.Rows.Count; ++i) { ndt.Rows.Add(new object[] { (i+1).ToString(), dt_category.Rows[i]["cat_name"].ToString() }); } return ndt; } Code (markup): with result below: I have two columns id and Cat Name but I would like have 4 columns as shown below id , Cat Name , Select , ComboBox how to write code for two columns ? Select ( checkbox ) and ComboBox Please reply me solution. thanks
Easy public DataTable Select_Category() { dt_category = ds.GetTable("SELECT * FROM itc_category"); DataTable ndt = new DataTable(); ndt.Columns.Add("id"); ndt.Columns.Add("Cat Name"); ndt.Columns.Add("Select"); ndt.Columns.Add("ComboBox"); for (int i = 0; i < dt_category.Rows.Count; ++i) { ndt.Rows.Add(new object[] { (i+1).ToString(), dt_category.Rows[i]["cat_name"].ToString(),..... }); } return ndt; } Code (markup):