Bind Column Names to checkbox listhttp://forums.asp.net/t/1775602.aspx/1?Bind+Column+Names+to+checkbox+listMon, 05 Mar 2012 14:28:19 -050017756024859010http://forums.asp.net/p/1775602/4859010.aspx/1?Bind+Column+Names+to+checkbox+listBind Column Names to checkbox list <p>is it possible to bind just the column names of a dataset to a checkboxlist. So i have ten columns in my dataset containing products sold by a company and want to populate the checkbox list with these column names so that we can track if the products are sold by the company.</p> <p>Thanks Ahead of time for any input</p> <p></p> 2012-03-01T13:37:00-05:004859019http://forums.asp.net/p/1775602/4859019.aspx/1?Re+Bind+Column+Names+to+checkbox+listRe: Bind Column Names to checkbox list <p>Hi..</p> <p>Plz use the below code...</p> <p>In Aspx page:</p> <p>&lt;asp:CheckBoxList ID=&quot;cblist&quot; runat=&quot;Server&quot;&gt;&lt;/asp:CheckBoxList&gt;</p> <p>In server side page:</p> <p>cblist.DataSource = ds(This is dataset)<br> cblist.DataTextField = &quot;COLUMN_NAME&quot;<br> cblist.DataValueField = &quot;ID&quot;<br> cblist.DataBind()</p> 2012-03-01T13:43:08-05:004859044http://forums.asp.net/p/1775602/4859044.aspx/1?Re+Bind+Column+Names+to+checkbox+listRe: Bind Column Names to checkbox list <p>Hi...try this</p> <pre class="prettyprint">cmd.Connection = con cmd.CommandType = CommandType.Text cmd.CommandText = Sql dap = New SqlDataAdapter() dap.SelectCommand = cmd dap.Fill(dt) Chbox.Items.Clear() Chbox.DataSource = dt.DefaultView.ToTable(True, &quot;name&quot;) Chbox.DataTextField = &quot;name&quot; Chbox.DataBind()</pre> 2012-03-01T13:53:11-05:004864552http://forums.asp.net/p/1775602/4864552.aspx/1?Re+Bind+Column+Names+to+checkbox+listRe: Bind Column Names to checkbox list <p>I actually went a different route. SInce Datasets dont have columns or rows i needed to pull the DataTable and populate the checkbox using</p> <p>cblClinInfo.DataSource = ds_1.Tables[0].Columns;</p> <p></p> <p>Thanks</p> <p>all for the help</p> 2012-03-05T14:28:19-05:00