private void InitPartner() { Partners ps = new Partners(); Partner p = ps.GetByLangGroup("ru", this.GroupID); if (p != null) { if(ddlRegion.Items.Count == 0) ddlRegion.DataBind(); ListItem item = ddlRegion.Items.FindByValue(p.RegionID.ToString()); if (item != null && item.Value == p.RegionID.ToString()) { ddlRegion.SelectedValue = p.RegionID.ToString(); } if (ddlCity.Items.Count == 0) ddlCity.DataBind(); item = ddlCity.Items.FindByValue(p.CityID.ToString()); if (item != null && item.Value == p.CityID.ToString()) { ddlCity.SelectedValue = p.CityID.ToString(); } if (ddlStatus.Items.Count == 0) ddlStatus.DataBind(); item = ddlStatus.Items.FindByValue(p.PartnerStatusID.ToString()); if (item != null && item.Value == p.PartnerStatusID.ToString()) { ddlStatus.SelectedValue = p.PartnerStatusID.ToString(); } txtTelephone.Text = p.Telephone; txtUrl.Text = p.Url; PartnerSpecializations partnerSpecializations = new PartnerSpecializations(); List<Specialization> specializations = partnerSpecializations.GetAllSpecializationByPartner(p); chbSpecialization.ClearSelection(); for (int i = 0; i < chbSpecialization.Items.Count; i++) { for (int j = 0; j < specializations.Count; j++) { if (chbSpecialization.Items[i].Value == specializations[j].GroupID.ToString()) { chbSpecialization.Items[i].Selected = true; break; } } } } }
protected void GridViewItemsList_RowCommand(object sender, GridViewCommandEventArgs e) { Partners dao = new Partners(); if (e.CommandName == "On" || e.CommandName == "Off") { int id = int.Parse((string)e.CommandArgument); dao.ChangePublishStatus(id); } GridViewItemsList.DataBind(); }