protected void Page_Load(object sender, EventArgs e) { SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Properties_Header)); if (IsPostBack) { return; } ddlGroup.DataSource = PropertyGroupService.GetList(); ddlGroup.DataBind(); ddlGroup.Items.Insert(0, Resource.Admin_m_Property_None); foreach (PropertyType item in Enum.GetValues(typeof(PropertyType))) { ddlTypes.Items.Add(new ListItem(item.GetLocalizedName(), ((int)item).ToString())); } if (PropertyId != 0) { btnOK.Text = Resource.Admin_m_News_Save; LoadProperty(PropertyId); } else { btnOK.Text = Resource.Admin_m_News_Add; txtName.Text = string.Empty; if (GroupId != 0 && ddlGroup.Items.FindByValue(GroupId.ToString()) != null) { ddlGroup.SelectedValue = GroupId.ToString(); } } }
protected void grid_DataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { var ddlNewGroups = ((DropDownList)e.Row.FindControl("ddlNewGroupName")); if (ddlNewGroups != null) { ddlNewGroups.DataSource = PropertyGroupService.GetList(); ddlNewGroups.DataBind(); } } }
private void LoadGroups() { var groups = PropertyGroupService.GetList(); groups.Insert(0, new PropertyGroup() { Name = Resource.Admin_Properties_UngroupedProperties, PropertyGroupId = 0 }); lvGroups.DataSource = groups; lvGroups.DataBind(); ddlAllGroups.DataSource = groups; ddlAllGroups.DataBind(); }