I have a checkboxlist control in the insertitem template of a listview and so far I have been unable to populate it with values from my db. I can do it in the page_load event when the checkboxlist is outside the listview but have no idea how to achieve the same results when the checkboxlist is inside the listview. Here is the code for populating the checkboxlist outside of the listview control:
Can anyone show me how to do the same but with the checkboxlist inside my listview control, specifically within the insertitem template.
Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["fmsConnectionString1"].ConnectionString);
SqlCommand objCmd = new SqlCommand("select * from payment_methods", objConn);
objConn.Open();
cblPageLoad.DataSource = objCmd.ExecuteReader(CommandBehavior.CloseConnection);
cblPageLoad.DataBind();
}
}
Can anyone show me how to do the same but with the checkboxlist inside my listview control, specifically within the insertitem template.