protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item) is GridDataItem) { vwDemand ent = (vwDemand)e.Item.DataItem; GridDataItem item = (GridDataItem)e.Item; Label lblTitle = (Label)item["Header"].FindControl("lblTitle"); Label lblPostDate = (Label)item["Header"].FindControl("lblPostDate"); Label lblEndDate = (Label)item["Header"].FindControl("lblEndDate"); Label lblDemandType = (Label)item["Header"].FindControl("lblDemandType"); Label lblBudget = (Label)item["Header"].FindControl("lblBudget"); Label lblLocation = (Label)item["Header"].FindControl("lblLocation"); HyperLink hlDetail = (HyperLink)item["Header"].FindControl("hlDetail"); lblTitle.Text = ent.Title; //TODO: fix format of dates according to browser settings lblPostDate.Text = ent.PostedDate.ToShortDateString(); lblEndDate.Text = ent.PostingEndDate.ToShortDateString(); lblDemandType.Text = ent.DemandTypeName; lblBudget.Text = string.Format("{0} - {1} per {2}", ent.MinimumBudget.ToString(), ent.MaxBudget.ToString(), ent.JobUnitName); lblLocation.Text = string.Format("{0}, {1}", ent.LocationCity, ent.LocationCountry); hlDetail.NavigateUrl = string.Format(hlDetail.NavigateUrl, ent.ProfileID, ent.ID); _Keywords += ent.Title + " "; if (!string.IsNullOrEmpty(_Description)) { _Description = ent.DemandTypeName; } } }
private void PopulateControls() { try { lnkBackToList.NavigateUrl = "~/PersonDemand.aspx?ProfileID=" + ObjProfile.ID; if (DemandID <= 0) { SwapPanels(false); GiveSourceToGrid(true); } else { SwapPanels(true); vwDemand demand = GoProGoDC.ProfileDC.GetDemandByID(DemandID).SingleOrDefault(); tblDemand demandDesc = GoProGoDC.ProfileDC.GetDemandDescriptionByID(DemandID).SingleOrDefault(); if (demand != null) { lblTitle.Text = demand.Title; //TODO: Format date according to browser settings lblPostDate.Text = demand.PostedDate.ToShortDateString(); lblEndDate.Text = demand.PostingEndDate.ToShortDateString(); lblDemandType.Text = demand.DemandTypeName; lblBudget.Text = string.Format("{0} - {1} per {2}", demand.MinimumBudget.ToString(), demand.MaxBudget.ToString(), demand.JobUnitName); lblLocation.Text = string.Format("{0}, {1}", demand.LocationCity, demand.LocationCountry); lblDemandDescription.Text = demandDesc.Description; _Description = demandDesc.Description.Substring(0, demandDesc.Description.Length > 200 ? 200 : demandDesc.Description.Length); _Keywords = demandDesc.SearchTags; } else { throw new Exception(string.Format("Invalid DemandID {0}.", DemandID)); } } } catch (Exception ex) { ThrowError(this, new ControlErrorArgs() { InnerException = ex, Message = "Can not load demand(s).", Severity = 3 }); } }