protected void btnSave_Click(object sender, EventArgs e) { try { IList <int> branchesID = new List <int>(); foreach (ListItem item in cblBranches.Items) { if (item.Selected) { branchesID.Add(Convert.ToInt32(item.Value)); } } packageProvider.UpdatePackagesAtBranch( Convert.ToInt32(ddlPackage.SelectedValue), branchesID); WebFormHelper.SetLabelTextWithCssClass( lblMessage, String.Format("Settings for <b>{0}</b> saved.", ddlPackage.SelectedItem.Text), LabelStyleNames.AlternateMessage); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass( lblMessage, ex.Message, LabelStyleNames.ErrorMessage); } }