I am using a checkbox as follows:
protected System.Web.UI.WebControls.CheckBoxList cblReading;
Now I store the index(checked marked) in an array for postback method, i.e.,
I save the selected indexes in array :
ArrayList selItems = (ArrayList)Session["webform6_cblReading"];
And I have to repopulate the cblReading on post back.
DataView for ReadingsList
// property delivers the list of Reading
private DataView ReadingsList
{
get
{
DataSet myDataSet = new DataSet ();
myDataSet.ReadXml(Server.MapPath("PersonalInterest s/Readings.xml"));
return (myDataSet.Tables["reading"].DefaultView);
}
}
There should be two for loops
private void FillcblReading(DataView data)
{
this.cblReading.DataSource = data;
this.cblReading.DataMember = "title";
this.cblReading.DataTextField = "text";
this.cblReading.DataValueField = "value";
this.cblReading.DataBind();
ArrayList selItems = (ArrayList)Session["webform6_cblReading"];
if ((ArrayList)Session["webform6_cblReading"] != null)
{
foreach (? in selItems)
{
// Check to see where the index is and assign the item.Selected = true
foreach (ListItem item in this.cblReading.Items)
{
item.Selected =
}
}
}
}
}
--
macupryk - forum member
http://www.visual-basic-data-mining.net/forum