here is sample code for using checkboxlist
Code:
con = new SqlConnection();
con.ConnectionString = @"Data Source=#####;Initial Catalog=####;Integrated Security=True;Pooling=False";
com = new SqlCommand();
com.CommandText = "select * from tablename";
com.Connection = con;
con.Open();
try
{
dr = com.ExecuteReader();
DropDownList1.Items.Add("select catagory");
while (dr.Read())
{
if (!IsPostBack)
{
CheckBoxList1.Items.Add(dr.GetString(2));
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
con.Close();
}
u can got the selected checkbox
Code:
CheckBoxList1.SelectedItem
Bookmarks