private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Imprimir"; commandColumn.HeaderText = @"Imprimir"; commandColumn.DefaultText = @"Imprimir"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Imprimir"].AllowSort = false; grdItems.Columns["Imprimir"].AllowFiltering = false; grdItems.Columns.Add("COPE_NumDoc", "Número Operación", "COPE_NumDoc"); grdItems.Columns.Add("COPE_FecEmi", "Fecha Emisión", "COPE_FecEmi"); grdItems.Columns.Add("Cliente", "Cliente", "Cliente"); grdItems.Columns.Add("COPE_HBL", "HBL", "COPE_HBL"); grdItems.Columns.Add("MonedaSTR", "Moneda", "MonedaSTR"); grdItems.Columns.Add("CONS_CodEstadoSTR", "Estado", "CONS_CodEstadoSTR"); grdItems.Columns.Add("COPE_Observacion", "Observacación", "COPE_Observacion"); grdItems.BestFitColumns(); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Titulo, Mensajes.FormatDataGridView, ex); } }
private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Edit"; commandColumn.HeaderText = @"Editar"; commandColumn.DefaultText = @"Editar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Edit"].AllowSort = false; grdItems.Columns["Edit"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Delete"; commandColumn.HeaderText = @"Eliminar"; commandColumn.DefaultText = @"Eliminar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Delete"].AllowSort = false; grdItems.Columns["Delete"].AllowFiltering = false; grdItems.Columns.Add("TIPO_Banco", "Banco", "TIPO_Banco"); grdItems.Columns.Add("TIPO_Moneda", "Moneda", "TIPO_Moneda"); grdItems.Columns.Add("CACU_NroCuenta", "Cuenta", "CACU_NroCuenta"); grdItems.BestFitColumns(); tsmColumnas.DropDownItems.Clear(); defaultColumns = new string[grdItems.Columns.Count]; int index = 0; foreach (GridViewDataColumn column in grdItems.Columns) { ToolStripMenuItem _item = new ToolStripMenuItem(column.HeaderText); _item.Tag = column.Name; _item.Checked = column.IsVisible; _item.CheckOnClick = true; _item.Click += tsmColumna_Click; tsmColumnas.DropDownItems.Add(_item); if (column.IsVisible) { defaultColumns[index] = column.Name; index += 1; } } ToolStripSeparator tsmSeparacion = new ToolStripSeparator(); tsmColumnas.DropDownItems.Add(tsmSeparacion); tsmTodos = new ToolStripMenuItem("Todos"); tsmTodos.Tag = "Todas"; tsmTodos.Checked = false; tsmTodos.CheckOnClick = true; tsmTodos.Click += tsmTodos_Click; tsmColumnas.DropDownItems.Add(tsmTodos); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.FormatDataGridView, ex); } }
public void ShowItems() { try { BSItems.DataSource = Presenter.Items; grdItems.DataSource = BSItems; navItems.BindingSource = BSItems; BSItems.ResetBindings(true); if (grdItems.RowCount > 0) { grdItems.Enabled = true; GridAutoFit.Fit(grdItems); } else { grdItems.Enabled = false; } } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Titulo, Mensajes.ShowItems, ex); } }
public void ShowItems() { try { BSItems.DataSource = Presenter._DT; grdItems.DataSource = BSItems; navItems.BindingSource = BSItems; BSItems.ResetBindings(true); if (grdItems.RowCount > 0) { grdItems.Enabled = true; btnExportar.Enabled = true; GridAutoFit.Fit(grdItems); grdItems.Columns["CCCT_TipoCambio"].FormatString = "{0:#,##0.000}"; } else { grdItems.Enabled = false; btnExportar.Enabled = false; } } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.ShowItems, ex); } }
private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Edit"; commandColumn.HeaderText = @"Editar"; commandColumn.DefaultText = @"Editar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Edit"].AllowSort = false; grdItems.Columns["Edit"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Delete"; commandColumn.HeaderText = @"Eliminar"; commandColumn.DefaultText = @"Eliminar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Delete"].AllowSort = false; grdItems.Columns["Delete"].AllowFiltering = false; grdItems.Columns.Add("CTAR_Numero", "Número Tarifa", "CTAR_Numero"); grdItems.Columns.Add("CTAR_Descrip", "Descripción", "CTAR_Descrip"); switch (Presenter.TipoTarifa) { case "L": grdItems.Columns.Add("DepTemporal", "Depósito Temporal", "DepTemporal"); grdItems.Columns.Add("DepVacio", "Depósito Vacio", "DepVacio"); break; case "A": grdItems.Columns.Add("LNVaviera", "Linea Naviera", "LNVaviera"); grdItems.Columns.Add("AgMaritimo", "Agente Maritimo", "Agente Maritimo"); grdItems.Columns.Add("AgAduanera", "Agente Aduana", "AgAduanera"); break; case "T": grdItems.Columns.Add("LNVaviera", "Linea Naviera", "LNVaviera"); grdItems.Columns.Add("AgMaritimo", "Agente Maritimo", "Agente Maritimo"); grdItems.Columns.Add("Transporte", "Transporte", "Transporte"); break; } grdItems.Columns.Add("CTAR_FecIni", "Fecha de Inicio", "CTAR_FecIni"); grdItems.Columns.Add("CTAR_FecFin", "Fecha de Fin", "CTAR_FecFin"); grdItems.BestFitColumns(); tsmColumnas.DropDownItems.Clear(); defaultColumns = new string[grdItems.Columns.Count]; int index = 0; foreach (GridViewDataColumn column in grdItems.Columns) { ToolStripMenuItem _item = new ToolStripMenuItem(column.HeaderText); _item.Tag = column.Name; _item.Checked = column.IsVisible; _item.CheckOnClick = true; _item.Click += tsmColumna_Click; tsmColumnas.DropDownItems.Add(_item); if (column.IsVisible) { defaultColumns[index] = column.Name; index += 1; } } ToolStripSeparator tsmSeparacion = new ToolStripSeparator(); tsmColumnas.DropDownItems.Add(tsmSeparacion); tsmTodos = new ToolStripMenuItem("Todos"); tsmTodos.Tag = "Todas"; tsmTodos.Checked = false; tsmTodos.CheckOnClick = true; tsmTodos.Click += tsmTodos_Click; tsmColumnas.DropDownItems.Add(tsmTodos); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.FormatDataGridView, ex); } }
private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Edit"; commandColumn.HeaderText = @"Editar"; commandColumn.DefaultText = @"Editar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Edit"].AllowSort = false; grdItems.Columns["Edit"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Delete"; commandColumn.HeaderText = @"Eliminar"; commandColumn.DefaultText = @"Eliminar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Delete"].AllowSort = false; grdItems.Columns["Delete"].AllowFiltering = false; grdItems.Columns.Add("TIPC_Fecha", "Fecha", "TIPC_Fecha"); grdItems.Columns["TIPC_Fecha"].Width = 100; grdItems.Columns["TIPC_Fecha"].TextAlignment = ContentAlignment.MiddleLeft; grdItems.Columns["TIPC_Fecha"].ReadOnly = true; grdItems.Columns.Add("TIPC_Compra", "Compra", "TIPC_Compra"); grdItems.Columns["TIPC_Compra"].FormatString = @"{0:###,##0.0000}"; grdItems.Columns["TIPC_Compra"].Width = 100; grdItems.Columns["TIPC_Compra"].TextAlignment = ContentAlignment.MiddleRight; grdItems.Columns["TIPC_Compra"].ReadOnly = true; grdItems.Columns.Add("TIPC_Venta", "Venta", "TIPC_Venta"); grdItems.Columns["TIPC_Venta"].FormatString = @"{0:###,##0.0000}"; grdItems.Columns["TIPC_Venta"].FormatString = @"{0:###,##0.0000}"; grdItems.Columns["TIPC_Venta"].Width = 100; grdItems.Columns["TIPC_Venta"].TextAlignment = ContentAlignment.MiddleRight; grdItems.Columns["TIPC_Venta"].ReadOnly = true; grdItems.Columns.Add("TIPC_DolEuro", "Cambio US$ a €", "TIPC_DolEuro"); grdItems.Columns["TIPC_DolEuro"].FormatString = @"{0:###,##0.000000}"; grdItems.Columns["TIPC_DolEuro"].FormatString = @"{0:###,##0.000000}"; grdItems.Columns["TIPC_DolEuro"].Width = 120; grdItems.Columns["TIPC_DolEuro"].TextAlignment = ContentAlignment.MiddleRight; grdItems.Columns["TIPC_DolEuro"].ReadOnly = true; grdItems.BestFitColumns(); tsmColumnas.DropDownItems.Clear(); defaultColumns = new string[grdItems.Columns.Count]; int index = 0; foreach (GridViewDataColumn column in grdItems.Columns) { ToolStripMenuItem _item = new ToolStripMenuItem(column.HeaderText); _item.Tag = column.Name; _item.Checked = column.IsVisible; _item.CheckOnClick = true; _item.Click += tsmColumna_Click; tsmColumnas.DropDownItems.Add(_item); if (column.IsVisible) { defaultColumns[index] = column.Name; index += 1; } } ToolStripSeparator tsmSeparacion = new ToolStripSeparator(); tsmColumnas.DropDownItems.Add(tsmSeparacion); tsmTodos = new ToolStripMenuItem("Todos"); tsmTodos.Tag = "Todas"; tsmTodos.Checked = false; tsmTodos.CheckOnClick = true; tsmTodos.Click += tsmTodos_Click; tsmColumnas.DropDownItems.Add(tsmTodos); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.FormatDataGridView, ex); } }
private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Edit"; commandColumn.HeaderText = @"Editar"; commandColumn.DefaultText = @"Editar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Edit"].AllowSort = false; grdItems.Columns["Edit"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Delete"; commandColumn.HeaderText = @"Eliminar"; commandColumn.DefaultText = @"Eliminar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Delete"].AllowSort = false; grdItems.Columns["Delete"].AllowFiltering = false; grdItems.Columns.Add("TIPO_Documento", "Tipo Documento", "TIPO_Documento"); grdItems.Columns.Add("Proveedor", "Proveedor", "Proveedor"); grdItems.Columns.Add("COPE_NumDoc", "Operación", "COPE_NumDoc"); grdItems.Columns.Add("COPE_HBL", "HBL", "COPE_HBL"); grdItems.Columns.Add("Cliente", "Cliente", "Cliente"); grdItems.Columns.Add("COPE_Estado", "Estado", "COPE_Estado"); grdItems.Columns.Add("CCCT_Serie", "Serie", "CCCT_Serie"); grdItems.Columns.Add("CCCT_Numero", "Número", "CCCT_Numero"); grdItems.Columns.Add("CCCT_FechaEmision", "Fecha Emisión", "CCCT_FechaEmision"); grdItems.Columns.Add("CCCT_FecReg", "Fecha Registro", "CCCT_FecReg"); grdItems.Columns.Add("SERVICIO", "Servicio", "SERVICIO"); grdItems.Columns.Add("TIPO", "Tipo", "TIPO"); grdItems.Columns.Add("TIPO_Moneda", "Moneda", "TIPO_Moneda"); grdItems.Columns.Add("CCCT_ValVta", "Valor Costo", "CCCT_ValVta"); grdItems.Columns.Add("CCCT_Imp1", "IGV", "CCCT_Imp1"); grdItems.Columns.Add("TIPO_TI3", "Tipo de Renta 3ra", "TIPO_TI3"); grdItems.Columns.Add("CCCT_Imp2", "Renta 3ra", "CCCT_Imp2"); grdItems.Columns.Add("RetencionIGV", "Retención IGV", "RetencionIGV"); grdItems.Columns.Add("CCCT_Monto", "Monto", "CCCT_Monto"); grdItems.Columns.Add("CCCT_Saldo", "Saldo", "CCCT_Saldo"); grdItems.Columns.Add("CCCT_Monto_S", "Monto S/.", "CCCT_Monto_S"); grdItems.Columns.Add("CCCT_Monto_D", "Monto US$", "CCCT_Monto_D"); grdItems.Columns.Add("CCCT_TipoCambio", "Tipo de Cambio", "CCCT_TipoCambio"); grdItems.Columns.Add("TIPO_FPG", "Forma de Pago", "TIPO_FPG"); grdItems.Columns.Add("ConDetraccion_text", "Detracción", "ConDetraccion_text"); grdItems.Columns.Add("TIPO_DET", "Tipo Detracción", "TIPO_DET"); grdItems.Columns.Add("AsientoContable", "Nro. Asiento", "AsientoContable"); grdItems.Columns.Add("DocumentoSAP", "Documento SAP", "DocumentoSAP"); grdItems.Columns.Add("CCCT_Codigo", "Código Interno", "CCCT_Codigo"); grdItems.BestFitColumns(); grdItems.Columns["CCCT_ValVta"].FormatString = "{0:#,###,##0.00}"; grdItems.Columns["CCCT_Imp1"].FormatString = "{0:#,###,##0.00}"; grdItems.Columns["CCCT_Imp2"].FormatString = "{0:#,###,##0.00}"; grdItems.Columns["CCCT_Monto"].FormatString = "{0:#,###,##0.00}"; grdItems.Columns["CCCT_Saldo"].FormatString = "{0:#,###,##0.00}"; grdItems.Columns["CCCT_Monto_S"].FormatString = "{0:#,###,##0.00}"; grdItems.Columns["CCCT_Monto_D"].FormatString = "{0:#,###,##0.00}"; tsmColumnas.DropDownItems.Clear(); defaultColumns = new string[grdItems.Columns.Count]; int index = 0; foreach (GridViewDataColumn column in grdItems.Columns) { ToolStripMenuItem _item = new ToolStripMenuItem(column.HeaderText); _item.Tag = column.Name; _item.Checked = column.IsVisible; _item.CheckOnClick = true; _item.Click += tsmColumna_Click; tsmColumnas.DropDownItems.Add(_item); if (column.IsVisible) { defaultColumns[index] = column.Name; index += 1; } } ToolStripSeparator tsmSeparacion = new ToolStripSeparator(); tsmColumnas.DropDownItems.Add(tsmSeparacion); tsmTodos = new ToolStripMenuItem("Todos"); tsmTodos.Tag = "Todas"; tsmTodos.Checked = false; tsmTodos.CheckOnClick = true; tsmTodos.Click += tsmTodos_Click; tsmColumnas.DropDownItems.Add(tsmTodos); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.FormatDataGridView, ex); } }
private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; //### commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Edit"; commandColumn.HeaderText = @"Editar"; commandColumn.DefaultText = @"Editar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Edit"].AllowSort = false; grdItems.Columns["Edit"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Anular"; commandColumn.HeaderText = @"Anular"; commandColumn.DefaultText = @"Anular"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Anular"].AllowSort = false; grdItems.Columns["Anular"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Imprimir"; commandColumn.HeaderText = @"Imprimir"; commandColumn.DefaultText = @"Imprimir"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Imprimir"].AllowSort = false; grdItems.Columns["Imprimir"].AllowFiltering = false; //### grdItems.Columns.Add("DOCV_Serie", "Serie", "DOCV_Serie"); grdItems.Columns.Add("DOCV_Numero", "Nro.", "DOCV_Numero"); grdItems.Columns.Add("DOCV_FechaEmision", "Fecha Emisión", "DOCV_FechaEmision"); grdItems.Columns.Add("Moneda", "Moneda", "Moneda"); grdItems.Columns.Add("DOCV_ValorVtaTotal", "Valor Venta", "DOCV_ValorVtaTotal"); grdItems.Columns.Add("Cliente", "Cliente", "Cliente"); grdItems.Columns.Add("TIPO_TDO_Factura", "T. Documento", "TIPO_TDO_Factura"); grdItems.Columns.Add("NroFactura", "Nro. Documento", "NroFactura"); grdItems.Columns.Add("MontoFactura", "Monto Documento", "MontoFactura"); grdItems.Columns.Add("HBL_MBL", "MBL / HBL", "HBL_MBL"); grdItems.Columns.Add("OV_OP", "OP / OV", "OV_OP"); grdItems.Columns.Add("DOCV_Codigo", "Interno", "DOCV_Codigo"); grdItems.BestFitColumns(); tsmColumnas.DropDownItems.Clear(); defaultColumns = new string[grdItems.Columns.Count]; int index = 0; foreach (GridViewDataColumn column in grdItems.Columns) { ToolStripMenuItem _item = new ToolStripMenuItem(column.HeaderText); _item.Tag = column.Name; _item.Checked = column.IsVisible; _item.CheckOnClick = true; _item.Click += tsmColumna_Click; tsmColumnas.DropDownItems.Add(_item); if (column.IsVisible) { defaultColumns[index] = column.Name; index += 1; } } ToolStripSeparator tsmSeparacion = new ToolStripSeparator(); tsmColumnas.DropDownItems.Add(tsmSeparacion); tsmTodos = new ToolStripMenuItem("Todos"); tsmTodos.Tag = "Todas"; tsmTodos.Checked = false; tsmTodos.CheckOnClick = true; tsmTodos.Click += tsmTodos_Click; tsmColumnas.DropDownItems.Add(tsmTodos); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.FormatDataGridView, ex); } }
private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Edit"; commandColumn.HeaderText = @"Editar"; commandColumn.DefaultText = @"Editar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Edit"].AllowSort = false; grdItems.Columns["Edit"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Delete"; commandColumn.HeaderText = @"Eliminar"; commandColumn.DefaultText = @"Eliminar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Delete"].AllowSort = false; grdItems.Columns["Delete"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Print"; commandColumn.HeaderText = @"Imprimir"; commandColumn.DefaultText = @"Imprimir"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Print"].AllowSort = false; grdItems.Columns["Print"].AllowFiltering = false; grdItems.Columns.Add("CAJA_FechaEmision", "fecha", "CAJA_FechaEmision"); grdItems.Columns.Add("CAJA_Tipo", "Tipo de Movimiento", "CAJA_Tipo"); grdItems.Columns.Add("Cliente", Presenter.CAJA_Tipo == "P"?"Proveedor":"Cliente", "Cliente"); grdItems.Columns.Add("TipoPago", "Tipo de Pago", "TipoPago"); grdItems.Columns.Add("TIPO_Moneda", "Moneda", "TIPO_Moneda"); grdItems.Columns.Add("TIPO_Banco", "Banco", "TIPO_Banco"); grdItems.Columns.Add("CACU_NroCuenta", "Nro. Cuenta", "CACU_NroCuenta"); grdItems.Columns.Add("CAJA_NroCheque", "Nro. Cheque", "CAJA_NroCheque"); grdItems.Columns.Add("CAJA_Total", "Monto", "CAJA_Total"); grdItems.Columns.Add("COPE_NumDoc", "Nro. Operación", "COPE_NumDoc"); grdItems.Columns.Add("COPE_HBL", "HBL", "COPE_HBL"); grdItems.Columns.Add("Numero", "Factura", "Numero"); //grdItems.Columns.Add("Saldo", "Saldo", "Saldo"); grdItems.BestFitColumns(); tsmColumnas.DropDownItems.Clear(); defaultColumns = new string[grdItems.Columns.Count]; int index = 0; foreach (GridViewDataColumn column in grdItems.Columns) { ToolStripMenuItem _item = new ToolStripMenuItem(column.HeaderText); _item.Tag = column.Name; _item.Checked = column.IsVisible; _item.CheckOnClick = true; _item.Click += tsmColumna_Click; tsmColumnas.DropDownItems.Add(_item); if (column.IsVisible) { defaultColumns[index] = column.Name; index += 1; } } ToolStripSeparator tsmSeparacion = new ToolStripSeparator(); tsmColumnas.DropDownItems.Add(tsmSeparacion); tsmTodos = new ToolStripMenuItem("Todos"); tsmTodos.Tag = "Todas"; tsmTodos.Checked = false; tsmTodos.CheckOnClick = true; tsmTodos.Click += tsmTodos_Click; tsmColumnas.DropDownItems.Add(tsmTodos); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.FormatDataGridView, ex); } }
private void FormatDataGrid() { try { RadGridLocalizationProvider.CurrentProvider = new MySpanishRadGridLocalizationProvider(); grdItems.Columns.Clear(); grdItems.AllowAddNewRow = false; GridViewCommandColumn commandColumn; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Edit"; commandColumn.HeaderText = "Editar"; commandColumn.DefaultText = "Editar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Edit"].AllowSort = false; grdItems.Columns["Edit"].AllowFiltering = false; //commandColumn = new GridViewCommandColumn(); //commandColumn.Name = "Delete"; //commandColumn.HeaderText = "Eliminar"; //commandColumn.DefaultText = "Eliminar"; //commandColumn.UseDefaultText = true; //grdItems.Columns.Add(commandColumn); //grdItems.Columns["Delete"].AllowSort = false; //grdItems.Columns["Delete"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Aprobar"; commandColumn.HeaderText = "Aprobar"; commandColumn.DefaultText = "Aprobar"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Aprobar"].AllowSort = false; grdItems.Columns["Aprobar"].AllowFiltering = false; commandColumn = new GridViewCommandColumn(); commandColumn.Name = "Anular"; commandColumn.HeaderText = "Anular"; commandColumn.DefaultText = "Anular"; commandColumn.UseDefaultText = true; grdItems.Columns.Add(commandColumn); grdItems.Columns["Anular"].AllowSort = false; grdItems.Columns["Anular"].AllowFiltering = false; grdItems.Columns.Add("CCOT_NumDoc", "Número Cotización", "CCOT_NumDoc"); grdItems.Columns.Add("CCOT_FecEmi", "Fecha Emisión", "CCOT_FecEmi"); grdItems.Columns.Add("CCOT_FecVcto", "Fecha Vencimiento", "CCOT_FecVcto"); grdItems.Columns.Add("Cliente", "Cliente", "Cliente"); grdItems.Columns.Add("LNaviera", "Linea Naviera", "LNaviera"); grdItems.Columns.Add("CONS_CodEstadosTR", "Estado", "CONS_CodEstadosTR"); grdItems.Columns.Add("CCOT_Observaciones", "Observaciones", "CCOT_Observaciones"); grdItems.BestFitColumns(); tsmColumnas.DropDownItems.Clear(); defaultColumns = new string[grdItems.Columns.Count]; int index = 0; foreach (GridViewDataColumn column in grdItems.Columns) { ToolStripMenuItem _item = new ToolStripMenuItem(column.HeaderText); _item.Tag = column.Name; _item.Checked = column.IsVisible; _item.CheckOnClick = true; _item.Click += tsmColumna_Click; tsmColumnas.DropDownItems.Add(_item); if (column.IsVisible) { defaultColumns[index] = column.Name; index += 1; } } ToolStripSeparator tsmSeparacion = new ToolStripSeparator(); tsmColumnas.DropDownItems.Add(tsmSeparacion); tsmTodos = new ToolStripMenuItem("Todos"); tsmTodos.Tag = "Todas"; tsmTodos.Checked = false; tsmTodos.CheckOnClick = true; tsmTodos.Click += tsmTodos_Click; tsmColumnas.DropDownItems.Add(tsmTodos); GridAutoFit.Fit(grdItems); } catch (Exception ex) { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.FormatDataGridView, ex); } }