protected void grid_Transport_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { //if (e.DataColumn.Caption == "Job Status") //{ // string status = SafeValue.SafeString(this.grid_Transport.GetRowValues(e.VisibleIndex, "JobStatus")); // if (status == "USE") // { // e.Cell.BackColor = System.Drawing.Color.LightGreen; // } // if (status == "CLS") // { // e.Cell.BackColor = System.Drawing.Color.Orange; // } // if (status == "CNL") // { // e.Cell.BackColor = System.Drawing.Color.Red; // } //} }
/// <summary> /// Davinder Kumar 03-06-2011 /// Method Use To Prepare the Girdview Cells correspond to goal id and need id /// </summary> protected void GridViewCustomTPNeed_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { //string Checked=string.Empty; //using (DataSet dataSetTreatmentPlan = BaseCommonFunctions.GetScreenInfoDataSet()) //{ // if (e.DataColumn.FieldName == "NeedId") // { // string lstSessionNeedId = string.Empty; // DataRow[] drSessionNeeds = dataSetTreatmentPlan.Tables["CustomTPGoalNeeds"].Select("NeedId='" + NeedId + "' and ISNULL(RecordDeleted,'N')<>'Y'"); // foreach (DataRow drNeeds in drSessionNeeds) // { // lstSessionNeedId += drNeeds["TPGoalId"].ToString() + ","; // } // DataRow[] dRowGoalNeed = dataSetTreatmentPlan.Tables["CustomTPGoalNeeds"].Select("TPGoalId='" + TPGoalId + "' AND NeedId='" + NeedId + "' and ISNULL(RecordDeleted,'N')<>'Y'"); // if (dRowGoalNeed.Length > 0) // { // Checked = "Checked"; // //e.Cell.Text = "<table><tr><td style='width:20px;'><img id=Img_CustomTPGoalNeeds_" + NeedId + " name=Img_CustomTPGoalNeeds_" + NeedId + " src=" + RelativePath + "App_Themes/Includes/Images/deleteIcon.gif tag=" + dRowGoalNeed[0]["TPGoalNeeds"].ToString() + " style='cursor:hand;display:None;' onclick = \"DeleteTpGoalNeeds('" + NeedId + "','" + e.GetValue("LinkedInDb") + "','" + e.GetValue("LinkedInSession") + "');\"/></td><td><input type='checkbox' checked='checked' id='CheckBox_" + NeedId + "_" + NeedText + "' name='CheckBox_" + NeedId + "_" + NeedText + "' style='width:20px;' onclick=ChangeDisplayChecked('Img_CustomTPGoalNeeds_" + NeedId + "','CheckBox_" + NeedId + "') /> <label for='CheckBox_" + NeedId + "_" + NeedText + "' >" + SHS.BaseLayer.BaseCommonFunctions.TrancateElementText(NeedText, 20) + "</label> <input type='hidden' id='Hidden_" + NeedId + "' value='" + NeedText + "' /> <input type='hidden' id='HiddenSessionNeeds_" + NeedId + "' value='"+lstSessionNeedId+"' /> </td></tr></table>"; // e.Cell.Text = "<table><tr><td style='width:20px;'><img id=Img_CustomTPGoalNeeds_" + NeedId + " name=Img_CustomTPGoalNeeds_" + NeedId + " src=" + RelativePath + "App_Themes/Includes/Images/deleteIcon.gif tag=" + dRowGoalNeed[0]["TPGoalNeeds"].ToString() + " style='cursor:hand;display:None;' onclick = \"DeleteTpGoalNeeds('" + NeedId + "','" + e.GetValue("LinkedInDb") + "','" + e.GetValue("LinkedInSession") + "');\"/></td><td><input type='checkbox' checked='checked' id='CheckBox_" + NeedId + "' name='CheckBox_" + NeedId + "' style='width:20px;' onclick=ChangeDisplayChecked('Img_CustomTPGoalNeeds_" + NeedId + "','CheckBox_" + NeedId + "') /> <label for='CheckBox_" + NeedId + "_" + NeedText + "' >" + SHS.BaseLayer.BaseCommonFunctions.TrancateElementText(NeedText, 20) + "</label> <input type='hidden' id='Hidden_" + NeedId + "' value='" + NeedText + "' /> <input type='hidden' id='HiddenSessionNeeds_" + NeedId + "' value='" + lstSessionNeedId + "' /> </td></tr></table>"; // } // else // { // Checked = string.Empty; // e.Cell.Text = "<table><tr><td style='width:20px;'><img id=Img_CustomTPGoalNeeds_" + NeedId + " name=Img_CustomTPGoalNeeds_" + NeedId + " src=" + RelativePath + "App_Themes/Includes/Images/deleteIcon.gif tag=" + -1 + " style='cursor:hand;display:block;' onclick = \"DeleteTpGoalNeeds('" + NeedId + "','" + e.GetValue("LinkedInDb") + "','" + e.GetValue("LinkedInSession") + "');\"/></td><td><input type='checkbox' id='CheckBox_" + NeedId + "' name='CheckBox_" + NeedId + "' style='width:20px' onclick=ChangeDisplayChecked('Img_CustomTPGoalNeeds_" + NeedId + "','CheckBox_" + NeedId + "') /> <label for='CheckBox_" + NeedId + "_" + NeedText + "' >" + SHS.BaseLayer.BaseCommonFunctions.TrancateElementText(NeedText, 20) + "</label><input type='hidden' id='Hidden_" + NeedId + "' value='" + NeedText + "' /> <input type='hidden' id='HiddenSessionNeeds_" + NeedId + "' value='" + lstSessionNeedId + "' /> </td></tr></table>"; // } // } // //GrantPermissionTemplateItems // if (e.DataColumn.FieldName == "DateNeed") // { // e.DataColumn.CellStyle.HorizontalAlign=HorizontalAlign.Center; // DataRow[] dRowGoalNeed = dataSetTreatmentPlan.Tables["CustomTPGoalNeeds"].Select("TPGoalId='" + TPGoalId + "' AND NeedId='" + NeedId + "' and ISNULL(RecordDeleted,'N')<>'Y'"); // if (dRowGoalNeed.Length > 0) // { // e.Cell.Text = (dRowGoalNeed[0]["DateNeedAddedtoPlan"].ToString().Trim()!=string.Empty)?Convert.ToDateTime(dRowGoalNeed[0]["DateNeedAddedtoPlan"]).ToString("MM/dd/yyyy"):""; // } // } //} }
protected void listChiTiet_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "parentid") { ASPxLabel lbldonVi = listChiTiet.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblDV") as ASPxLabel; { if (e.CellValue != null) { unit = objUnit.GetUnit(Int32.Parse(e.CellValue.ToString())); if (unit != null) { if (lbldonVi != null) { lbldonVi.Text = unit.name; } } } } } }
protected void listChiTiet_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "positionid") { ASPxLabel lblChucVu = listChiTiet.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblCV") as ASPxLabel; { VNPT.Modules.Position.PositionController objPosition = new VNPT.Modules.Position.PositionController(); if (e.CellValue != null) { position = objPosition.GetPosition(Int32.Parse(e.CellValue.ToString())); if (position != null) { if (lblChucVu != null) { lblChucVu.Text = position.name; } } } } } if (e.DataColumn.FieldName == "unitid") { ASPxLabel lbldonVi = listChiTiet.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblDV") as ASPxLabel; { if (e.CellValue != null) { unit = objUnit.GetUnit(Int32.Parse(e.CellValue.ToString())); if (unit != null) { if (lbldonVi != null) { UnitInfo parentUnit = objUnit.GetUnit(unit.parentid); lbldonVi.Text = unit.name + " -- " + parentUnit.name; } } } } } }
//改变当前处理列的颜色 protected void gridRGZ_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "CQBZCL") { e.Cell.ForeColor = System.Drawing.Color.Red; } if (e.DataColumn.FieldName == "SPZT") { int intspzt = int.Parse(e.GetValue("SPZT").ToString()); switch (intspzt) { case 0: e.Cell.Text = "未审批"; break; case 1: e.Cell.Text = "已审批"; break; } } }
protected void grvDelivery_Detail_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { status = this.lblStatus.Text.ToString(); if (status.ToLower() == "delay") { if (e.GetValue("LOADED_QTY") != null) { Int32 iTargetValue = Convert.ToInt32(e.GetValue("LOADED_QTY")); if (e.DataColumn.FieldName.Equals("LOADED_QTY")) { if (iTargetValue > 0) { e.Cell.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000"); } else { e.Cell.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); } } } } }
protected void grdBalanceOfInventoryCart_OnHtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { ASPxGridView grid = sender as ASPxGridView; if (e.DataColumn.Name == "IsOriginal") { if (bool.Parse(e.GetValue("IsOriginal").ToString())) { e.Cell.Text = "Cập nhật tương ứng"; } else { e.Cell.Text = "Cập nhật do phát sinh"; } } }
protected void gridMainMonitor_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { int recommendedIndex = 4; string currentCulture = SessionManager.CurrentLanguage; if (e.DataColumn.Index == recommendedIndex) { decimal recommended = 0; decimal.TryParse(gridMainMonitor.GetDataRow(e.VisibleIndex)[e.DataColumn.Index - 1].ToString(), NumberStyles.Any, CultureInfo.CreateSpecificCulture(currentCulture), out recommended); if (recommended > 0) { e.Cell.Text = string.Format("{0}", recommended.ToString("N2", CultureInfo.CreateSpecificCulture(SessionManager.CurrentLanguage))); } else { e.Cell.Text = " "; } } else if (e.DataColumn.Index >= recommendedIndex) { decimal recommended = 0; decimal current = 0; decimal.TryParse(gridMainMonitor.GetDataRow(e.VisibleIndex)[3].ToString(), NumberStyles.Any, CultureInfo.CreateSpecificCulture(currentCulture), out recommended); decimal.TryParse(gridMainMonitor.GetDataRow(e.VisibleIndex)[e.DataColumn.Index - 1].ToString(), NumberStyles.Any, CultureInfo.CreateSpecificCulture(currentCulture), out current); if ((recommended > 0) && (current != 0)) { decimal result = 0; decimal percent = 0; this.CalculateMonitorValues(current, recommended, out result, out percent); //change colors int cc = this.GetColorCombination(current, recommended); int selCond = cbConditions.SelectedIndex; if ((cc == 1) || (cc == 11) || (cc == 101) || (cc == 110)) { if (selCond == 1) { e.Cell.ForeColor = Color.Black; } else { e.Cell.ForeColor = Color.Green; } } else if ((cc == 0) || (cc == 10) || (cc == 100) || (cc == 111)) { if (selCond == 2) { e.Cell.ForeColor = Color.Black; } else { e.Cell.ForeColor = Color.Red; } } else { e.Cell.ForeColor = Color.Black; } //make links if ((current - recommended) == 0) { e.Cell.Text = this.GetUrlForValue(string.Format("{0}", result.ToString("N2", CultureInfo.CreateSpecificCulture(SessionManager.CurrentLanguage))), e.DataColumn.Caption, (int)e.KeyValue, e.Cell.ForeColor); } else { e.Cell.Text = this.GetUrlForValue(string.Format("{0} ({1}%)", result.ToString("N2", CultureInfo.CreateSpecificCulture(SessionManager.CurrentLanguage)), percent.ToString("N2")), e.DataColumn.Caption, (int)e.KeyValue, e.Cell.ForeColor); } } else if ((recommended == 0) || (current == 0)) { e.Cell.Text = " "; } } }