protected void DominoCustomGridView_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.EditForm) { //Mukund: VSPLUS-844, Page redirect on callback try { if (e.GetValue("ID") != " " && e.GetValue("ID") != null) { ASPxWebControl.RedirectOnCallback("DominoStatistic.aspx?ID=" + e.GetValue("ID")); Context.ApplicationInstance.CompleteRequest();//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback //1/21/2014 NS added Session["Submenu"] = null; } else { ASPxWebControl.RedirectOnCallback("DominoStatistic.aspx"); Context.ApplicationInstance.CompleteRequest();//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback } } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); //throw ex; } } }
protected void griddataElements_OnHtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != GridViewRowType.Data) { return; } // if required highlight the row if (e.GetValue("required").ToString() == "Required") { if (!string.IsNullOrEmpty(e.GetValue("uwfld").ToString())) { e.Row.BackColor = Color.LightSkyBlue; } else { List <string> skip = new List <string> { "subjectkey", "src_subject_id", "gender" }; if (skip.Contains(e.GetValue("name").ToString())) { e.Row.BackColor = Color.LightSkyBlue; } else if (!string.IsNullOrEmpty(e.GetValue("fx").ToString()) & !string.IsNullOrEmpty(e.GetValue("params").ToString())) { e.Row.BackColor = Color.Lavender; } else { e.Row.BackColor = Color.Red; } } } else { if (!string.IsNullOrEmpty(e.GetValue("uwfld").ToString())) { e.Row.BackColor = Color.PowderBlue; } } //// if field is already matched highlight the row //if (!string.IsNullOrEmpty(e.GetValue("matchedname").ToString())) //{ // if (e.GetValue("required").ToString() == "Required") // { // e.Row.BackColor = Color.LightSkyBlue; // } // else // { // e.Row.BackColor = Color.PowderBlue; // } //} }
/// <summary> /// Davinder Kumar 03-06-2011 /// Method Use To get the Data of The Rows /// </summary> protected void GridViewCustomTPNeed_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != GridViewRowType.Data || e.Row.Cells.Count < 3) { return; } if (e.GetValue("NeedId").ToString() != "") { NeedId = Convert.ToInt32(e.GetValue("NeedId")); } if (e.GetValue("NeedText").ToString() != "") { NeedText = HttpUtility.UrlEncode(Convert.ToString(e.GetValue("NeedText"))); } else { NeedText = string.Empty; } 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.Row.Cells[0].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.Row.Cells[0].Text = "<table width='43'><tr><td style='width:18px;'><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 style='width:18px'><input type='checkbox' checked='checked' id='CheckBox_" + NeedId + "' name='CheckBox_" + NeedId + "' onclick=ChangeDisplayChecked('Img_CustomTPGoalNeeds_" + NeedId + "','CheckBox_" + NeedId + "') /> <input type='hidden' id='Hidden_" + NeedId + "' value='" + NeedText + "' /> <input type='hidden' id='HiddenSessionNeeds_" + NeedId + "' value='" + lstSessionNeedId + "' /> </td></tr></table>"; e.Row.Cells[2].Text = (dRowGoalNeed[0]["DateNeedAddedtoPlan"].ToString().Trim() != string.Empty) ? Convert.ToDateTime(dRowGoalNeed[0]["DateNeedAddedtoPlan"]).ToString("MM/dd/yyyy") : ""; } else { Checked = string.Empty; e.Row.Cells[0].Text = "<table width='43'><tr><td style='width:18px;'><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 style='width:18px'><input type='checkbox' id='CheckBox_" + NeedId + "' name='CheckBox_" + NeedId + "' onclick=ChangeDisplayChecked('Img_CustomTPGoalNeeds_" + NeedId + "','CheckBox_" + NeedId + "') /><input type='hidden' id='Hidden_" + NeedId + "' value='" + NeedText + "' /> <input type='hidden' id='HiddenSessionNeeds_" + NeedId + "' value='" + lstSessionNeedId + "' /> </td></tr></table>"; } e.Row.Cells[1].Text = "<label for='CheckBox_" + NeedId + "_" + NeedText + "' id='label_" + NeedId + "'>" + SHS.BaseLayer.BaseCommonFunctions.TrancateElementText(HttpUtility.UrlDecode(NeedText), 20) + "</label>"; //GrantPermissionTemplateItems //e.DataColumn.CellStyle.HorizontalAlign = HorizontalAlign.Center; //DataRow[] dRowGoalNeed = dataSetTreatmentPlan.Tables["CustomTPGoalNeeds"].Select("TPGoalId='" + TPGoalId + "' AND NeedId='" + NeedId + "' and ISNULL(RecordDeleted,'N')<>'Y'"); } }
protected void gridSteps_OnHtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { var color = (int?)e.GetValue("AlertColor"); var days = (int?)e.GetValue("AlertDays"); if (color.HasValue && days.HasValue && days.Value > 0) { e.Row.BackColor = Color.FromArgb(color.Value); } } }
protected void gridDict_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != GridViewRowType.Data) { return; } double ord_pos = Convert.ToDouble(e.GetValue("ord_pos").ToString()); string color = "White"; if (ord_pos <= 0.90) { color = "LightGray"; } else { color = (e.VisibleIndex % 2 == 1) ? "WhiteSmoke" : "White"; } Color c = Color.FromName(color); //this works //e.Row.BackColor = c; //this does not work e.Row.BackColor = c; }
protected void gridActDocument_OnHtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { var color = (int?)e.GetValue("DocColor"); if (color.HasValue) { e.Row.BackColor = Color.FromArgb(color.Value); } } }
protected void gridList_OnHtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { var visibleIndex = e.VisibleIndex; var chShow = gridList.FindRowCellTemplateControl(visibleIndex, null, "chShow") as ASPxCheckBox; if (chShow != null) { chShow.Checked = (bool) e.GetValue("Show"); chShow.ClientSideEvents.ValueChanged = jsFunctionOverlay(string.Format("ShowPaymentData_Change(s.GetValue(), '{0}');", e.KeyValue)); } } }
protected void grid_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != GridViewRowType.Data) return; String POS_NAME = e.GetValue("POS_NAME").ToString(); if (POS_NAME != LastPosName) { LastPosName = POS_NAME; } else { e.Row.Cells[1].Style["border-top"] = "2px outset white"; } }
protected void GridDetector_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.KeyValue != null) { if (e.GetValue("AUTH").ToString() == "System") { e.Row.Visible = false; } } }
protected void gridSearchView_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return; switch (Convert.ToInt32(e.GetValue("significance"))) { case 1: { e.Row.BackColor = Color.SandyBrown; break; } case 2: { e.Row.BackColor = Color.Salmon; break; } } }
/// <summary> /// An cac row co IsDisabled bang true /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gridRoster_OnHtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { try { if (e.RowType == GridViewRowType.Data) { e.Row.Visible = !Boolean.Parse(e.GetValue("IsDisabled").ToString()); } } catch (Exception ex) { LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient()); } }
protected void AspxGV2_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != GridViewRowType.Data) return; e.Row.BackColor = System.Drawing.Color.FromName(e.GetValue("isUpdate").ToString()); }
//end incremental filtering of company name /// <summary> /// row created show break pod link button if quote is linked to pod /// button clientviasible=false by default /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gridviewPrices1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Data) { DevExpress.Web.ASPxGridView.ASPxGridView _grid = (DevExpress.Web.ASPxGridView.ASPxGridView)sender; Int32 _onKey = e.GetValue("order_no")!= null? wwi_func.vint(e.GetValue("order_no").ToString()): 0; if (_onKey > 0) { //find template controls DevExpress.Web.ASPxGridView.GridViewDataColumn _col1 = (DevExpress.Web.ASPxGridView.GridViewDataColumn)_grid.Columns["colorderno"]; DevExpress.Web.ASPxEditors.ASPxButton _btn = (DevExpress.Web.ASPxEditors.ASPxButton)_grid.FindRowCellTemplateControl(e.VisibleIndex, _col1, "dxbtnbreak"); //var _chk = (DevExpress.Web.ASPxGridView.Rendering.GridViewTableCommandCell)e.Row.Cells[0]; //and pass data from hidden field if it's stored - make sure text box is ticked if (_btn != null) { _btn.ClientVisible = true; } } } }
protected void grid_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != GridViewRowType.Data) return; String TYPE_NAME = e.GetValue("TYPE_NAME").ToString(); if (TYPE_NAME != LastTypeName) { //LastTypeName = TYPE_NAME; } else { } }
/// <summary> /// hide link to documents if no document folder linked to order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gridOrder_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return; int _docs = e.GetValue("document_folder") != null? (int)e.GetValue("document_folder"): 0; DevExpress.Web.ASPxEditors.ASPxButton _obj = this.gridOrder.FindRowCellTemplateControl(e.VisibleIndex, null, "dxbtnDocs") as DevExpress.Web.ASPxEditors.ASPxButton; if (_obj != null) { //set clientside functionality here as we need to pass document folder id to javascript function _obj.Visible = _docs > 0? true: false; _obj.ClientSideEvents.Click = string.Format("function(s, e) {{ onViewDocuments('{0}'); }}", _docs.ToString()); } }
protected void ASPxGridView1_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Data) { string n_IdProducto = e.GetValue("n_IdProducto").ToString(); int i_IdMenu = int.Parse(Request.QueryString["IdMenu"]); LinkButton lbProducto = new LinkButton(); lbProducto = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[2]), "lbProducto"); lbProducto.PostBackUrl = "CrearProducto.aspx?n_IdProducto=" + n_IdProducto + "&IdMenu=30"; lbProducto.Enabled = chkEditar.Checked; LinkButton lbMinka = new LinkButton(); lbMinka = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[3]), "lbMinka"); Label lblIdAlmacenMinka = new Label(); lblIdAlmacenMinka = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[3]), "lblIdAlmacenMinka"); lbMinka.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdAlmacenMinka.Text + "&origen=global&IdMenu=" + i_IdMenu; LinkButton lbBellavista = new LinkButton(); lbBellavista = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[4]), "lbBellavista"); Label lblIdAlmacenBellavista = new Label(); lblIdAlmacenBellavista = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[4]), "lblIdAlmacenBellavista"); lbBellavista.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdAlmacenBellavista.Text + "&origen=global&IdMenu=" + i_IdMenu; LinkButton lbSantaAnita = new LinkButton(); lbSantaAnita = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[5]), "lbSantaAnita"); Label lblIdAlmacenSantaAnita = new Label(); lblIdAlmacenSantaAnita = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[5]), "lblIdAlmacenSantaAnita"); lbSantaAnita.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdAlmacenSantaAnita.Text + "&origen=global&IdMenu=" + i_IdMenu; LinkButton lbSantaClara = new LinkButton(); lbSantaClara = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[6]), "lbSantaClara"); Label lblIdAlmacenSantaClara = new Label(); lblIdAlmacenSantaClara = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[6]), "lblIdAlmacenSantaClara"); lbSantaClara.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdAlmacenSantaClara.Text + "&origen=global&IdMenu=" + i_IdMenu; LinkButton lbPlayCentral = new LinkButton(); lbPlayCentral = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[7]), "lbPlayCentral"); Label lblIdAlmacenPlayCentral = new Label(); lblIdAlmacenPlayCentral = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[7]), "lblIdAlmacenPlayCentral"); lbPlayCentral.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdAlmacenPlayCentral.Text + "&origen=global&IdMenu=" + i_IdMenu; LinkButton lbAlmacenCentral = new LinkButton(); lbAlmacenCentral = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[8]), "lbAlmacenCentral"); Label lblIdAlmacenCentral = new Label(); lblIdAlmacenCentral = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[8]), "lblIdAlmacenCentral"); lbAlmacenCentral.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdAlmacenCentral.Text + "&origen=global&IdMenu=" + i_IdMenu; LinkButton lbChorrillos = new LinkButton(); lbChorrillos = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[9]), "lbChorrillos"); Label lblIdChorrillos = new Label(); lblIdChorrillos = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[9]), "lblIdChorrillos"); lbChorrillos.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdChorrillos.Text + "&origen=global&IdMenu=" + i_IdMenu; LinkButton lbMallDelSur = new LinkButton(); lbMallDelSur = (LinkButton)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[10]), "lbMallDelSur"); Label lblIdMallDelSur = new Label(); lblIdMallDelSur = (Label)ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)(ASPxGridView1.Columns[10]), "lblIdMallDelSur"); lbMallDelSur.PostBackUrl = "ListarKardex.aspx?n_IdProducto=" + n_IdProducto + "&n_IdAlmacen=" + lblIdMallDelSur.Text + "&origen=global&IdMenu=" + i_IdMenu; } }
protected void grid_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { try { if (e.RowType != GridViewRowType.Data) return; bool isdtroy = false; if (e.GetValue("isdeleted").ToString() != null) { Boolean.TryParse(e.GetValue("isdeleted").ToString(), out isdtroy); if (isdtroy) { bool isPermissionRestore = false; try { bool.TryParse(PermissionInfo.Rows[0]["isrestore"].ToString(), out isPermissionRestore); } catch { } if (isPermissionRestore) { e.Row.Enabled = !isdtroy; e.Row.ForeColor = System.Drawing.Color.LightGray; } else { e.Row.Visible = false; } } } } catch { } }
protected void gridInflironiePeriod_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (!object.Equals(e.RowType, GridViewRowType.Data)) return; if (e.GetValue("MonthBegin") != null && e.GetValue("YearBegin") != null && e.GetValue("MonthEnd") != null && e.GetValue("YearEnd") != null) { bool hasError = (int) e.GetValue("MonthBegin") < 1 || (int) e.GetValue("MonthBegin") > 12; hasError = hasError || (int) e.GetValue("MonthEnd") < 1 || (int) e.GetValue("MonthEnd") > 12; hasError = hasError || (int) e.GetValue("YearBegin") < 2014 || (int) e.GetValue("YearBegin") > 9999; hasError = hasError || (int)e.GetValue("YearEnd") < 2014 || (int)e.GetValue("YearEnd") > 9999; hasError = hasError || ((int)e.GetValue("YearBegin") * 12 + (int)e.GetValue("MonthBegin")) > ((int)e.GetValue("YearEnd") * 12 + (int)e.GetValue("MonthEnd")); if (hasError) { e.Row.ForeColor = System.Drawing.Color.Red; } } else if (e.GetValue("MonthBegin") != null && e.GetValue("YearBegin") != null) { bool hasError = (int)e.GetValue("MonthBegin") < 1 || (int)e.GetValue("MonthBegin") > 12; hasError = hasError || (int)e.GetValue("YearBegin") < 2014 || (int)e.GetValue("YearBegin") > 9999; if (hasError) { e.Row.ForeColor = System.Drawing.Color.Red; } } }
protected void gv_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Data) { ASPxGridView gv = (ASPxGridView)sender; GridViewDataColumn VisibleEdit = (GridViewDataColumn)gv.Columns["VisibleEdit"]; ImageButton btnLeaveEdit = gv.FindRowCellTemplateControl(e.VisibleIndex, null, "btnLeaveEdit") as ImageButton; ImageButton btnLeaveDelOrCancel = gv.FindRowCellTemplateControl(e.VisibleIndex, null, "btnLeaveDelOrCancel") as ImageButton; if (e.GetValue("VisibleEdit").ToString() == "false") { btnLeaveEdit.Visible = false; } btnLeaveDelOrCancel.Visible = Convert.ToBoolean(e.GetValue("VisibleDelOrCancel")); btnLeaveDelOrCancel.ImageUrl = e.GetValue("imgDelOrCancel").ToString(); btnLeaveDelOrCancel.ToolTip = e.GetValue("ToolTipDelOrCancel").ToString(); if (e.GetValue("leave_status") != null ){ if (e.GetValue("leave_status").ToString() == "4" || e.GetValue("leave_status").ToString() == "5") { btnLeaveEdit.Visible = false; btnLeaveDelOrCancel.Visible = false; } } } }
/// <summary> /// rowcreated event can be usde to preformat grid /// e.g. change cell colour /// or provide additional functionality /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gridOrder_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { ASPxGridView _grid = (ASPxGridView)sender; //string _hfKey = "key" + e.KeyValue.ToString(); //this seems to be problematic (string too big for key??) string _hfKey = "key" + e.GetValue("OrderID").ToString(); //find order id //string _test = e.GetValue("OrderID").ToString(); //find template controls GridViewDataColumn _col1 = (GridViewDataColumn)_grid.Columns["CargoReady"]; DevExpress.Web.ASPxEditors.ASPxDateEdit _dte = (DevExpress.Web.ASPxEditors.ASPxDateEdit)_grid.FindRowCellTemplateControl(e.VisibleIndex, _col1, "dxdtcargoready"); GridViewDataColumn _col2 = (GridViewDataColumn)_grid.Columns["EstPallets"]; DevExpress.Web.ASPxEditors.ASPxTextBox _tx1 = (DevExpress.Web.ASPxEditors.ASPxTextBox)_grid.FindRowCellTemplateControl(e.VisibleIndex, _col2, "dxtxestpallets"); GridViewDataColumn _col3 = (GridViewDataColumn)_grid.Columns["EstWeight"]; DevExpress.Web.ASPxEditors.ASPxTextBox _tx2 = (DevExpress.Web.ASPxEditors.ASPxTextBox)_grid.FindRowCellTemplateControl(e.VisibleIndex, _col3, "dxtxestweight"); GridViewDataColumn _col4 = (GridViewDataColumn)_grid.Columns["EstVolume"]; DevExpress.Web.ASPxEditors.ASPxTextBox _tx3 = (DevExpress.Web.ASPxEditors.ASPxTextBox)_grid.FindRowCellTemplateControl(e.VisibleIndex, _col4, "dxtxestvolume"); //create client side events //and pass data from hidden field if (_dte != null && _tx1 != null && _tx1 != null && _tx3 != null) { //_dte.ClientSideEvents.ValueChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + ",dtcargo" + e.KeyValue.ToString() + ".GetValue()" + ");}"; //_tx1.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ");}"; //_tx2.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ");}"; //_tx3.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; //use s.gettext() for date box or we will be getting the date back in very long format! //_dte.ClientSideEvents.ValueChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + "," + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; //_tx1.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + "," + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; //_tx2.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + "," + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; //_tx3.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.KeyValue.ToString() + "," + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; _dte.ClientSideEvents.ValueChanged = "function(s,e){ProcessValueChanged(" + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; _tx1.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; _tx2.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; _tx3.ClientSideEvents.TextChanged = "function(s,e){ProcessValueChanged(" + e.GetValue("OrderID") + ",dtcargo" + e.KeyValue.ToString() + ".GetText()" + ",txpallets" + e.KeyValue.ToString() + ".GetValue()" + ",txweight" + e.KeyValue.ToString() + ".GetValue()" + ",txvolume" + e.KeyValue.ToString() + ".GetValue()" + ");}"; if (this.dxhfeditor.Contains(_hfKey)) { //element 0 is used to store OrderID string[] _pars = Convert.ToString(this.dxhfeditor[_hfKey]).Split(';'); _dte.Value = _pars[0]; _tx1.Text = _pars[1]; _tx2.Text = _pars[2]; _tx3.Text = _pars[3]; //e.Row.Cells[2].Style.Add("color", "Red"); } } } }
protected void gridAptosPagamento_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType != GridViewRowType.Data) return; string value = e.GetValue("TEMCONTASBANCO").ToString(); if (value != string.Empty && value != null) e.Row.BackColor = System.Drawing.Color.DarkSeaGreen; }
protected void GridGroupDetector_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.GetValue("N1ISSUESTATE") == null) { e.Row.Enabled = true; } else if (e.GetValue("N1ISSUESTATE").ToString() != "") { e.Row.Enabled = false; } }
}//end menu names loop #endregion #region gridview crud events /// <summary> /// on row created get lookup values /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dxgrdCourier_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { ASPxGridView _grd = (ASPxGridView)sender; try { if (e.RowType == GridViewRowType.Data) { //company int _id = wwi_func.vint(e.GetValue("DocsDespatchID").ToString()); string _txt = wwi_func.lookup_multi_values("CompanyName,Address1,Address2,Address3,CountryName,TelNo", "view_delivery_address", "CompanyID", _id); if (_txt != "") { string[] _lx = _txt.Split(Environment.NewLine.ToCharArray()); //company ASPxLabel _lbl = (ASPxLabel)_grd.FindRowTemplateControl(e.VisibleIndex, "dxlblDocsDespatchIDView"); if (_lbl != null) { _lbl.Text = _lx[0]; } //address _lbl = (ASPxLabel)_grd.FindRowTemplateControl(e.VisibleIndex, "dxlblDocsDespatchIDView2"); if (_lbl != null) { _lbl.Text = _txt.Replace(_lx[0], "").Trim(); ; } } //contact _id = wwi_func.vint(e.GetValue("ContactID").ToString()); _txt = wwi_func.lookup_multi_values("ContactName,Email", "ContactTable", "ContactID", _id, "|"); if (_txt != "") { string[] _lx = _txt.Split("|".ToCharArray()); //name ASPxLabel _lbl = (ASPxLabel)_grd.FindRowTemplateControl(e.VisibleIndex, "dxlblContactIDView"); if (_lbl != null) { _lbl.Text = _lx[0].Trim(); } //email _lbl = (ASPxLabel)_grd.FindRowTemplateControl(e.VisibleIndex, "dxlblContactIDView2"); if (_lbl != null) { _lbl.Text = _lx.Length > 0 ? _lx[1] : ""; } } //get the status value int _original = wwi_func.vint(e.GetValue("Original").ToString()); string _target = _original <= 2 ? "Despatch Date" : "Date Emailed"; //format date if original = 2 pass to docs despatched date, if 3 pass to emailed date string _dt = e.GetValue("DocumentationDespatched") != null ? wwi_func.vdatetime(e.GetValue("DocumentationDespatched").ToString()).ToShortDateString() : ""; //set caption ASPxLabel _lb = (ASPxLabel)_grd.FindRowTemplateControl(e.VisibleIndex, "dxlblDespatchDateCaption"); if (_lb != null) { _lb.Text = _target; } _lb = (ASPxLabel)_grd.FindRowTemplateControl(e.VisibleIndex, "dxlblDespatchDateView"); if (_lb != null) { _lb.Text = _dt; } } else if( e.RowType == GridViewRowType.EditForm) { //edit form stuff //populate company address label int _id = wwi_func.vint(e.GetValue("DocsDespatchID").ToString()); string _txt = wwi_func.lookup_multi_values("Address1,Address2,Address3,CountryName,TelNo", "view_delivery_address", "CompanyID", _id); if (_txt != "") { //string[] _lx = _txt.Split(Environment.NewLine.ToCharArray()); //address ASPxLabel _lb = (ASPxLabel)_grd.FindEditFormTemplateControl("dxlblAddress2"); if (_lb != null) { _lb.Text = _txt; } } //bind contact or we lose the contact name on edit ASPxComboBox _editor = (ASPxComboBox)_grd.FindEditFormTemplateControl("dxcboClientContact"); if (_editor != null) { string[] _cols = { "ContactID, ContactName", "Email" }; string[] _order = { "ContactName" }; SqlQuery _qry = new Select(_cols).From(DAL.Logistics.Tables.ContactTable).OrderAsc(_order); if (_id > 0) { _qry.Where("CompanyID").IsEqualTo(_id); } IDataReader _rd1 = _qry.ExecuteReader(); _editor.DataSource = _rd1; _editor.ValueField = "ContactID"; _editor.TextField = "ContactName"; _editor.DataBind(); _editor.SelectedItem = _editor.Items.FindByValue(e.GetValue("ContactID")); } }//end if } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text += _ex; this.dxpnlErr.ClientVisible = true; } }
protected void GridGroupDetail_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { if (e.KeyValue != null) { if (e.GetValue("AUTH").ToString() == "System") { e.Row.BackColor = Color.FromName("#E6E6FA"); e.Row.ForeColor = Color.Black; } else { } } }