public static void PopulatePackages(PackageProvider packageProvider, RadDropDownList dropdown, bool addEmptyOption = false) { dropdown.DataSource = packageProvider.GetAll(); dropdown.DataTextField = "Name"; dropdown.DataValueField = "ID"; dropdown.DataBind(); if (addEmptyOption) { dropdown.Items.Insert(0, new DropDownListItem(String.Empty)); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { foreach (var package in packageProvider.GetAll()) { ddlPackage.Items.Add(new ListItem(package.Name, package.ID.ToString())); } ddlPackage.Items.Insert(0, "Select package"); btnSave.Enabled = false; } }
public static void PopulatePackages(DropDownList dropdown, bool addEmptyOption = false) { PackageProvider provider = UnityContainerHelper.Container.Resolve <PackageProvider>(); dropdown.DataSource = provider.GetAll(); dropdown.DataTextField = "Name"; dropdown.DataValueField = "ID"; dropdown.DataBind(); if (addEmptyOption) { dropdown.Items.Insert(0, String.Empty); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { cblMembershipType.DataSource = packageProvider.GetAll(); cblMembershipType.DataTextField = "Name"; cblMembershipType.DataValueField = "ID"; cblMembershipType.DataBind(); cblCustomerStatus.DataSource = customerStatusProvider.GetAll(); cblCustomerStatus.DataTextField = "Description"; cblCustomerStatus.DataValueField = "ID"; cblCustomerStatus.DataBind(); DynamicControlBinding.BindDropDown(ddlBillingType, billingTypeProvider.GetActiveBillingTypes().Where(bt => bt.ID > 1), "Description", "ID", false); DynamicControlBinding.BindDropDown(ddlBranch, branchProvider.GetActiveBranches(), "Name", "ID", false); calFindDateFrom.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); calFindDateTo.SelectedDate = DateTime.Today; cblMembershipType.Items.Cast <ListItem>().ToList().ForEach(item => item.Selected = true); } }