protected void gvEstadoContratos_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { EstadosRutaTemp EstadoHoja = EntityDataSourceExtensions.GetItemObject <EstadosRutaTemp>(e.Item.DataItem); string colorEstado = ""; switch (EstadoHoja.Riesgo) { case "ALTO": colorEstado = "Red"; break; case "MEDIO": colorEstado = "Orange"; break; case "BAJO": colorEstado = "Yellow"; break; default: colorEstado = "Green"; break; } e.Item.Cells[11].Style.Add(HtmlTextWriterStyle.BackgroundColor, colorEstado); } } catch (Exception err) { var aa = err.Message; } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { Entidades.Plantilla hoja = EntityDataSourceExtensions.GetItemObject <Entidades.Plantilla>(e.Item.DataItem); hoja.RolesPlanilla.Load(); if (hoja.RolesPlanilla.Count > 0) { hoja.RolesPlanilla.First().SegRolReference.Load(); (e.Item.FindControl("lblRol") as Label).Text = hoja.RolesPlanilla.First().SegRol.Descripcion; } } else if (e.Item.ItemType == GridItemType.EditFormItem) { Entidades.Plantilla hoja = EntityDataSourceExtensions.GetItemObject <Entidades.Plantilla>(e.Item.DataItem); if (hoja != null) { hoja.RolesPlanilla.Load(); if (hoja.RolesPlanilla.Count > 0) { hoja.RolesPlanilla.First().SegRolReference.Load(); if (e.Item.FindControl("cboRoles") != null) { (e.Item.FindControl("cboRoles") as RadComboBox).SelectedValue = hoja.RolesPlanilla.First().SegRol.IdSegRol.ToString(); } } } } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { Entidades.Plantilla hoja = EntityDataSourceExtensions.GetItemObject <Entidades.Plantilla>(e.Item.DataItem); if (hoja != null) { if (hoja.RolesPlanilla.Count > 0) { (e.Item.FindControl("lblRol") as Label).Text = hoja.RolesPlanilla.First().SegRol.Descripcion; (e.Item.FindControl("lblRiesgo") as Label).Text = hoja.Riesgo; (e.Item.FindControl("lblGrado") as Label).Text = string.Format("Grado {0}", hoja.Grado); } } } else if (e.Item.ItemType == GridItemType.EditFormItem) { Entidades.Plantilla hoja = EntityDataSourceExtensions.GetItemObject <Entidades.Plantilla>(e.Item.DataItem); if (hoja != null) { if (hoja.RolesPlanilla.Count > 0) { if (e.Item.FindControl("cboRoles") != null) { (e.Item.FindControl("cboRoles") as RadComboBox).SelectedValue = hoja.RolesPlanilla.First().SegRol.IdSegRol.ToString(); Dictionary <string, string> riesgos = new Dictionary <string, string>(); riesgos.Add("ALTO", "ALTO"); riesgos.Add("MEDIO", "MEDIO"); riesgos.Add("BAJO", "BAJO"); (e.Item.FindControl("cboRiesgos") as RadComboBox).DataSource = riesgos; (e.Item.FindControl("cboRiesgos") as RadComboBox).DataBind(); (e.Item.FindControl("cboRiesgos") as RadComboBox).SelectedValue = hoja.Riesgo; Dictionary <string, string> grados = new Dictionary <string, string>(); grados.Add("1", "Grado 1"); grados.Add("2", "Grado 2"); grados.Add("3", "Grado 3"); grados.Add("4", "Grado 4"); grados.Add("5", "Grado 5"); (e.Item.FindControl("cboGrados") as RadComboBox).DataSource = grados; (e.Item.FindControl("cboGrados") as RadComboBox).DataBind(); (e.Item.FindControl("cboGrados") as RadComboBox).SelectedValue = hoja.Grado.ToString(); } } } } }
void gvLegajosAsociados_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { Entidades.ContEmpLegajos contratoemp = EntityDataSourceExtensions.GetItemObject <Entidades.ContEmpLegajos>(e.Item.DataItem); if (contratoemp.FechaTramiteBaja.HasValue) { e.Item.Style.Add(HtmlTextWriterStyle.Color, "Red"); e.Item.ToolTip = "Fecha Baja: " + contratoemp.FechaTramiteBaja.Value.ToShortDateString(); } } }