private void UpdateSelectedCat(int removedCatID) { List <ListItem> SelectedCategory = new List <ListItem>(); lblError.Visible = false; SelectedCount = 0; foreach (var item in ListviewSelectedCat.Items) { HiddenField hdnSelectedID = item.FindControl("hdnCategoryID") as HiddenField; Label lblCategory = item.FindControl("lblCategory") as Label; if (removedCatID.ToString() != hdnSelectedID.Value) { ListItem a = new ListItem(lblCategory.Text, hdnSelectedID.Value); SelectedCategory.Add(a); SelectedCount++; } } ListviewSelectedCat.DataSource = SelectedCategory; ListviewSelectedCat.DataBind(); }
public void setSelectedCategory(List <ListItem> selectedCats) { ListviewSelectedCat.DataSource = selectedCats; ListviewSelectedCat.DataBind(); SelectedCount = selectedCats.Count; }