J
Joel Barsotti
Hello,
I'm binding in a list of search options from my database, the listbox is
filled correctly, but I want all the items to be pre-selected. Doing the
following doesn't seem to work.
myDa.Fill(tempTable);
productTypeList.DataSource = new DataView(tempTable);
productTypeList.DataTextField = "productTypeName";
productTypeList.DataValueField = "productType";
productTypeList.DataBind();
foreach(ListItem li in productTypeList.Items)
{
li.Selected = true;
}
Am I missing something to update the control?
I'm binding in a list of search options from my database, the listbox is
filled correctly, but I want all the items to be pre-selected. Doing the
following doesn't seem to work.
myDa.Fill(tempTable);
productTypeList.DataSource = new DataView(tempTable);
productTypeList.DataTextField = "productTypeName";
productTypeList.DataValueField = "productType";
productTypeList.DataBind();
foreach(ListItem li in productTypeList.Items)
{
li.Selected = true;
}
Am I missing something to update the control?