Пример #1
0
        private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
        {
            //if (e.CellElement.ColumnInfo.Name == "ModelName")
            //{
            //    if (e.CellElement.RowInfo.Cells["ModelName"].Value != null)
            //    {
            //        if (!e.CellElement.RowInfo.Cells["ModelName"].Value.Equals(""))
            //        {
            //            e.CellElement.DrawFill = true;
            //            // e.CellElement.ForeColor = Color.Blue;
            //            e.CellElement.NumberOfColors = 1;
            //            e.CellElement.BackColor = Color.WhiteSmoke;
            //        }

            //    }
            //}
        }
Пример #2
0
        void EditorControl_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
        {
            if (e.ColumnIndex != -1 || e.CellElement.RowIndex == -1)
            {
                return;
            }
            if (e.CellElement.Children.Count == 1)
            {
                RadCheckBoxElement checkBoxElement = new RadCheckBoxElement();
                checkBoxElement.Padding   = new System.Windows.Forms.Padding(0, 3, 1, 0);
                checkBoxElement.Alignment = ContentAlignment.MiddleCenter;
                checkBoxElement.NotifyParentOnMouseInput = false;
                e.CellElement.Children.Add(checkBoxElement);
            }
            RadCheckBoxElement checkBox = e.CellElement.FindDescendant <RadCheckBoxElement>();

            checkBox.CheckStateChanged -= checkBox_CheckStateChanged;
            checkBox.IsChecked          = e.Row.Tag != null && e.Row.Tag.ToString() == Boolean.TrueString;
            checkBox.CheckStateChanged += checkBox_CheckStateChanged;
        }
 private void grdItems_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
 {
     try
     {
         if (e.CellElement is GridCommandCellElement)
         {
             if (e.Column.Name.Equals("Extornar"))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.scroll_error_16x16;
                     bte.ToolTipText       = @"Extornar Registro";
                     bte.AutoSize          = true;
                 }
             }
             if (e.Column.Name.Equals("Nullable"))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.forbidden_16x16;
                     bte.ToolTipText       = @"Anular Registro";
                     bte.AutoSize          = true;
                 }
             }
             if (e.CellElement.RowInfo is GridViewNewRowInfo && e.CellElement.ColumnInfo is GridViewCommandColumn)
             {
                 ((RadButtonElement)e.CellElement.Children[0]).Visibility = ElementVisibility.Hidden;
             }
         }
     }
     catch (Exception ex) { Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Presenter.Title, "Ha ocurrido un error al formatear el icono." + ex.Message); }
 }
Пример #4
0
        /// <summary>
        /// Event to handle the data formatting in data grid view
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">event data</param>
        private void DataGridView_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
        {
            //try
            //{
            //    if (e.ColumnIndex == 2)
            //    {
            //        e.CellElement.Value = string.Format("{0:dd/MM/yyyy}", (DateTime)e.CellElement.RowInfo.Cells[2].Value);
            //    }

            //if (e.ColumnIndex == 3)
            //{
            //    e.CellElement.Value = Enum.GetName(typeof(Occupation), e.CellElement.RowInfo.Cells[3].Value);
            //}

            //if (e.ColumnIndex == 4)
            //{
            //    e.CellElement.Value = Enum.GetName(typeof(MaritalStatus), e.CellElement.RowInfo.Cells[4].Value);
            //}

            //if (e.ColumnIndex == 5)
            //{
            //    e.CellElement.Value = Enum.GetName(typeof(HealthStatus), e.CellElement.RowInfo.Cells[5].Value);
            //}

            //if (e.ColumnIndex == 6)
            //{
            //    e.CellElement.Value = Convert.ToDecimal(e.CellElement.Value) == 0 ? string.Empty : e.CellElement.Value;
            //}

            //if (e.ColumnIndex == 7)
            //{
            //    e.CellElement.Value = Convert.ToInt16(e.CellElement.Value) == 0 ? string.Empty : e.CellElement.Value;
            //}
            //}
            //catch (Exception ex)
            //{
            //    this.ShowErrorMessage(ex);
            //}
        }
Пример #5
0
 private void gvDatos_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
 {
     try {
         if (gvDatos.RowCount > 0)
         {
             if (e.ColumnIndex > 4 && e.RowIndex != -1 && e.CellElement.Value != null)
             {
                 if (int.Parse(e.CellElement.Value.ToString()) < int.Parse(txtNorma.Text))
                 {
                     e.CellElement.DrawFill  = true;
                     e.CellElement.BackColor = Color.Red;
                 }
                 else
                 {
                     e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
                     e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
                 }
             }
         }
     } catch (Exception ex) {
         throw ex;
     }
 }
Пример #6
0
 private void gridEmployees_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
 {
     if (e.CellElement.ColumnInfo.Name == "No" && string.IsNullOrEmpty(e.CellElement.Text))
     {
         e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString();
     }
     if (e.CellElement.ColumnInfo.Name == "BirthDate" && Helper.ConvertToDate(e.CellElement.Text).Year == 1900)
     {
         e.CellElement.Text = "";
     }
     if (e.CellElement.ColumnInfo.Name == "IDIssuedDate" && Helper.ConvertToDate(e.CellElement.Text).Year == 1900)
     {
         e.CellElement.Text = "";
     }
     if (e.CellElement.ColumnInfo.Name == "PassportIssuedDate" && Helper.ConvertToDate(e.CellElement.Text).Year == 1900)
     {
         e.CellElement.Text = "";
     }
     if (e.CellElement.ColumnInfo.Name == "PassportExpiredDate" && Helper.ConvertToDate(e.CellElement.Text).Year == 1900)
     {
         e.CellElement.Text = "";
     }
 }
Пример #7
0
 private void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
 {
     if (e.CellElement is Telerik.WinControls.UI.GridFilterCellElement && e.CellElement.ColumnIndex == 0)
         e.CellElement.Children.Clear();
 }
Пример #8
0
 private void gvSejarahDisposisi_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
 {
 }
Пример #9
0
 protected virtual void OnCellFormatting(CellFormattingEventArgs e)
 {
     this.GridViewElement.OnCellFormatting((object)this, e);
 }
Пример #10
0
 protected override void OnViewCellFormatting(CellFormattingEventArgs e)
 {
     this.OnCellFormatting(e);
     base.OnViewCellFormatting(e);
 }
 private void grdItems_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
 {
     try
     {
         if (e.CellElement is GridCommandCellElement)
         {
             if (e.Column.Name.Equals("Edit"))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.editar16x16;
                     bte.ToolTipText       = @"Editar Registro";
                     bte.AutoSize          = true;
                 }
             }
             if (e.Column.Name.Equals("Nullable"))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.forbidden_16x16;
                     bte.ToolTipText       = @"Anular Registro";
                     bte.AutoSize          = true;
                 }
             }
             if (e.Column.Name.Equals("Delete"))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.Sign_07;
                     bte.ToolTipText       = @"Eliminar Registro";
                     bte.AutoSize          = true;
                 }
             }
             if (e.Column.Name.Equals("Print"))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.printer2_16x16;
                     bte.ToolTipText       = @"Imprimir Recibo";
                     bte.AutoSize          = true;
                 }
             }
             if (e.Column.Name.Equals("Cheque"))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.printer2_16x16;
                     bte.ToolTipText       = @"Imprimir Cheque";
                     bte.AutoSize          = true;
                 }
             }
             if (e.Column.Name.Equals("D.As."))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.delete_16x16;
                     bte.ToolTipText       = @"Desvincular Asiento de Reversion";
                     bte.AutoSize          = true;
                 }
             }
             if (e.Column.Name.Equals("R. As. R."))
             {
                 RadButtonElement bte = (RadButtonElement)e.CellElement.Children[0];
                 if (bte.Image == null)
                 {
                     bte.TextImageRelation = TextImageRelation.Overlay;
                     bte.DisplayStyle      = DisplayStyle.Image;
                     bte.ImageAlignment    = ContentAlignment.MiddleCenter;
                     bte.Image             = Resources.refresh;
                     bte.ToolTipText       = @"Regenerar Asiento de Reversión";
                     bte.AutoSize          = true;
                 }
             }
             if (e.CellElement.RowInfo is GridViewNewRowInfo && e.CellElement.ColumnInfo is GridViewCommandColumn)
             {
                 ((RadButtonElement)e.CellElement.Children[0]).Visibility = ElementVisibility.Hidden;
             }
         }
     }
     catch (Exception ex) { Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Presenter.Title, "Ha ocurrido un error al formatear el icono." + ex.Message); }
 }
Пример #12
0
 protected override void OnCellFormatting(CellFormattingEventArgs e)
 {
 }
Пример #13
0
 protected virtual void OnViewCellFormatting(CellFormattingEventArgs e)
 {
   if (this.GridViewElement == null)
     return;
   this.GridViewElement.OnViewCellFormatting((object) this, e);
 }