Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 05, 2012 02:28 PM by iggy985
Mar 01, 2012 01:37 PM|LINK
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.
Thanks Ahead of time for any input
Mar 01, 2012 01:43 PM|LINK
Plz use the below code...
In Aspx page:
<asp:CheckBoxList ID="cblist" runat="Server"></asp:CheckBoxList>
In server side page:
cblist.DataSource = ds(This is dataset)
cblist.DataTextField = "COLUMN_NAME"
cblist.DataValueField = "ID"
Mar 01, 2012 01:53 PM|LINK
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = Sql
dap = New SqlDataAdapter()
dap.SelectCommand = cmd
Chbox.DataSource = dt.DefaultView.ToTable(True, "name")
Chbox.DataTextField = "name"
Mar 05, 2012 02:28 PM|LINK
I actually went a different route. SInce Datasets dont have columns or rows i needed to pull the DataTable and populate the checkbox using
cblClinInfo.DataSource = ds_1.Tables.Columns;
all for the help