private void BindGrid() { this.employeesTableAdapter.Fill(this.northwindDataSet.Employees); this.radGridView1.DataSource = this.northwindDataSet.Employees; this.radGridView1.TableElement.BeginUpdate(); this.radGridView1.Columns["EmployeeID"].IsVisible = false; this.radGridView1.Columns["Title"].IsVisible = false; this.radGridView1.Columns["TitleOfCourtesy"].IsVisible = false; this.radGridView1.Columns["BirthDate"].IsVisible = false; this.radGridView1.Columns["Address"].IsVisible = false; this.radGridView1.Columns["PostalCode"].IsVisible = false; this.radGridView1.Columns["Extension"].IsVisible = false; this.radGridView1.Columns["ReportsTo"].IsVisible = false; this.radGridView1.Columns["Region"].IsVisible = false; this.radGridView1.Columns["City"].IsVisible = false; this.radGridView1.Columns["Country"].IsVisible = false; int columnWidth = 100; this.radGridView1.Columns["LastName"].HeaderText = "Last Name"; this.radGridView1.Columns["LastName"].HeaderTextAlignment = ContentAlignment.MiddleCenter; this.radGridView1.Columns["LastName"].Width = columnWidth; this.radGridView1.Columns["FirstName"].HeaderText = "First Name"; this.radGridView1.Columns["FirstName"].HeaderTextAlignment = ContentAlignment.MiddleCenter; this.radGridView1.Columns["FirstName"].Width = columnWidth; columnWidth = 150; this.radGridView1.Columns["HireDate"].HeaderText = "Hire Date"; this.radGridView1.Columns["HireDate"].HeaderTextAlignment = ContentAlignment.MiddleCenter; this.radGridView1.Columns["HireDate"].TextAlignment = ContentAlignment.MiddleRight; this.radGridView1.Columns["HireDate"].FormatString = "{0:MMMM d, yyyy}"; this.radGridView1.Columns["HireDate"].Width = columnWidth; this.radGridView1.Columns["HomePhone"].HeaderText = "Home Phone"; this.radGridView1.Columns["HomePhone"].HeaderTextAlignment = ContentAlignment.MiddleCenter; this.radGridView1.Columns["HomePhone"].Width = columnWidth; this.radGridView1.Columns["Notes"].HeaderTextAlignment = ContentAlignment.MiddleCenter; this.radGridView1.Columns["Notes"].WrapText = true; this.radGridView1.Columns["Notes"].Width = 380; this.radGridView1.Columns["Photo"].HeaderTextAlignment = ContentAlignment.MiddleCenter; this.radGridView1.Columns["Photo"].Width = 69; this.radGridView1.Columns["Photo"].MinWidth = 69; this.radGridView1.Columns["Photo"].MaxWidth = 69; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewImageColumn imageColumn = this.radGridView1.Columns["Photo"] as GridViewImageColumn; this.radGridView1.Columns.Move(imageColumn.Index, 0); imageColumn.ImageLayout = ImageLayout.Zoom; this.radGridView1.Columns.Move(this.radGridView1.Columns["FirstName"].Index, 1); this.radGridView1.TableElement.EndUpdate(); }
private void PrepareGrid(RadGridView grid) { GridViewImageColumn imageColumn = new GridViewImageColumn("Image", "Image"); imageColumn.Width = 50; imageColumn.HeaderText = String.Empty; GridViewTextBoxColumn nameColumn = new GridViewTextBoxColumn("Name", "Name"); nameColumn.Width = 70; GridViewTextBoxColumn countryColumn = new GridViewTextBoxColumn("Country", "Country"); countryColumn.Width = 90; GridViewDecimalColumn priceColumn = new GridViewDecimalColumn("Price", "Price"); priceColumn.Width = 90; priceColumn.FormatString = "{0:c}"; grid.Columns.Add(imageColumn); grid.Columns.Add(nameColumn); grid.Columns.Add(countryColumn); grid.Columns.Add(priceColumn); grid.TableElement.RowHeight = 50; grid.MasterTemplate.AllowRowReorder = true; grid.ReadOnly = true; grid.MultiSelect = true; grid.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; grid.GridBehavior = new CustomGridBehavior(); }
private void PrepareGrid() { GridViewImageColumn imageColumn = new GridViewImageColumn("Imagem") { Width = 16, HeaderText = String.Empty, TextAlignment = ContentAlignment.MiddleCenter }; GridViewTextBoxColumn dateColumn = new GridViewTextBoxColumn("Data") { Width = 50, TextAlignment = ContentAlignment.MiddleCenter }; GridViewTextBoxColumn infoColumn = new GridViewTextBoxColumn("Informações") { Width = 90, TextAlignment = ContentAlignment.MiddleLeft }; GrdListConnection.Columns.Add(imageColumn); GrdListConnection.Columns.Add(dateColumn); GrdListConnection.Columns.Add(infoColumn); GrdListConnection.TableElement.RowHeight = 22; GrdListConnection.MasterTemplate.AllowRowReorder = false; GrdListConnection.ReadOnly = true; GrdListConnection.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; }
private GridViewImageColumn GetIcon() { GridViewImageColumn column = new GridViewImageColumn { Name = "Icon", HeaderText = "Изображение" }; return(column); }
private void CSGridView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) { if (e.ColumnIndex < 0 || e.ColumnIndex >= this.Columns.Count || _allowImageColumnResize) { return; } // prevent the image column resizing event. GridViewImageColumn imgcol = this.Columns[e.ColumnIndex] as GridViewImageColumn; if (imgcol != null) { e.Cancel = true; } }
private void BindGrid() { GridViewImageColumn imageColumn = new GridViewImageColumn("CarPicture"); imageColumn.ImageLayout = ImageLayout.Zoom; imageColumn.MaxWidth = 80; imageColumn.MinWidth = 80; imageColumn.HeaderTextAlignment = ContentAlignment.MiddleCenter; imageColumn.HeaderText = "Car Picture"; GridViewTextBoxColumn col1 = new GridViewTextBoxColumn("CarName"); col1.Width = 300; col1.HeaderText = "Car"; col1.HeaderTextAlignment = ContentAlignment.MiddleCenter; GridViewDecimalColumn col2 = new GridViewDecimalColumn("Price"); col2.HeaderText = "Price"; col2.Width = 100; col2.FormatString = "${0:N0}"; col2.TextAlignment = ContentAlignment.MiddleRight; col2.HeaderTextAlignment = ContentAlignment.MiddleCenter; GridViewTextBoxColumn dataColumn = new GridViewTextBoxColumn("MaxSpeed"); dataColumn.TextAlignment = ContentAlignment.MiddleRight; dataColumn.HeaderText = "Max Speed"; dataColumn.FormatString = "{0} mph"; dataColumn.Width = 100; dataColumn.HeaderTextAlignment = ContentAlignment.MiddleCenter; GridViewTextBoxColumn companyColumn = new GridViewTextBoxColumn("CompanyName"); companyColumn.HeaderTextAlignment = ContentAlignment.MiddleCenter; companyColumn.HeaderText = "Manufacturer"; companyColumn.Width = 300; this.radGridView1.Columns.Add(imageColumn); this.radGridView1.Columns.Add(col1); this.radGridView1.Columns.Add(companyColumn); this.radGridView1.Columns.Add(col2); this.radGridView1.Columns.Add(dataColumn); radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.DataSource = CreateDataTable(); }
private void InitGrid() { this.radGridView1.MasterTemplate.AllowAddNewRow = false; this.radGridView1.MasterTemplate.AutoGenerateColumns = false; this.radGridView1.MasterTemplate.EnableFiltering = true; this.radGridView1.MasterTemplate.EnableSorting = true; this.radGridView1.MasterTemplate.EnableGrouping = true; this.radGridView1.DataSource = null; this.radGridView1.MasterTemplate.Columns.Clear(); var imageColumn = new GridViewImageColumn("image", "image"); imageColumn.HeaderText = "Image"; imageColumn.ImageLayout = ImageLayout.Zoom; imageColumn.Width = 150; this.radGridView1.MasterTemplate.Columns.Add(imageColumn); var asinColumn = new GridViewTextBoxColumn("external_product_id", "external_product_id"); asinColumn.HeaderText = "ASIN"; this.radGridView1.MasterTemplate.Columns.Add(asinColumn); this.radGridView1.MasterTemplate.Columns.Add("item_name", "Name", "item_name"); this.radGridView1.MasterTemplate.Columns.Add("price", "Price", "price"); var priceColumn = new GridViewDecimalColumn("real_price", "real_price"); priceColumn.HeaderText = "real_price"; this.radGridView1.MasterTemplate.Columns.Add(priceColumn); this.radGridView1.MasterTemplate.Columns.Add("Dimensions", "Dimensions", "Dimensions"); this.radGridView1.MasterTemplate.Columns.Add("Size", "Size", "Size"); this.radGridView1.MasterTemplate.Columns.Add("brand_name", "Brand", "brand_name"); this.radGridView1.MasterTemplate.Columns.Add("product_type_name", "Type", "product_type_name"); this.radGridView1.MasterTemplate.Columns.Add("department_name", "Department", "department_name"); var urlColumn = new GridViewHyperlinkColumn("Url", "Url"); urlColumn.HeaderText = "Url"; this.radGridView1.MasterTemplate.Columns.Add(urlColumn); for (int i = 1; i < radGridView1.MasterTemplate.Columns.Count; i++) { this.radGridView1.MasterTemplate.Columns[i].Width = 120; } this.radGridView1.DataSource = _products; }
//LLenar Grid Con array Objetos public void FillGrid(List<object[]> objs, RadGridView r,bool band=false) { r.Columns.Clear(); r.Rows.Clear(); foreach (object objectse in objs[0]) { r.Columns.Add(objectse.ToString()); } Image img = Resources.agenda.ToBitmap(); if (band) { GridViewImageColumn imageColumn = new GridViewImageColumn("Imprimir"); imageColumn.MaxWidth = 80; imageColumn.MinWidth = 80; imageColumn.HeaderTextAlignment = ContentAlignment.MiddleCenter; imageColumn.HeaderText = "Imprimir"; r.Columns.Add(imageColumn); } for (int i = 1; i < objs.Count; i++) { if (band) { object[] objsnnew = new object[objs[i].Length + 1]; for (int j = 0; j < objs[i].Length; j++) { objsnnew[j] = objs[i][j]; } objsnnew[objs[0].Length] = img; r.Rows.Add(objsnnew); } else { r.Rows.Add(objs[i]); } } r.TableElement.RowHeight = 55; r.TableElement.TableHeaderHeight = 35; }
private void Form1_Load(object sender, EventArgs e) { this.radGridView1.TableElement.RowHeight = 50; this.radGridView1.AllowAddNewRow = false; this.radGridView1.AllowRowReorder = true; this.radGridView1.ReadOnly = true; this.radGridView1.Rows.CollectionChanged += new NotifyCollectionChangedEventHandler(Rows_CollectionChanged); GridViewImageColumn imageColumn = new GridViewImageColumn("Image", "Image"); imageColumn.Width = 50; imageColumn.HeaderText = String.Empty; GridViewDecimalColumn priorityColumn = new GridViewDecimalColumn(typeof(int), "Priority", "Priority"); priorityColumn.HeaderText = "#"; priorityColumn.Width = 50; priorityColumn.ReadOnly = true; GridViewTextBoxColumn taskColumn = new GridViewTextBoxColumn("Task", "Task"); taskColumn.Width = 180; GridViewDateTimeColumn dueDateColumn = new GridViewDateTimeColumn("DueDate", "Due Date"); dueDateColumn.Width = 120; this.radGridView1.Columns.Add(priorityColumn); this.radGridView1.Columns.Add(imageColumn); this.radGridView1.Columns.Add(taskColumn); this.radGridView1.Columns.Add(dueDateColumn); this.BindGrid(); this.btnMoveUp.DisplayStyle = Telerik.WinControls.DisplayStyle.ImageAndText; this.btnMoveUp.TextImageRelation = TextImageRelation.ImageBeforeText; this.btnMoveDown.DisplayStyle = Telerik.WinControls.DisplayStyle.ImageAndText; this.btnMoveDown.TextImageRelation = TextImageRelation.ImageBeforeText; }
private void SetupMasterForUnbound() { this.radGridView1.TableElement.RowHeight = 60; GridViewImageColumn column = new GridViewImageColumn("Photo"); column.ImageLayout = ImageLayout.Zoom; column.HeaderText = "Photo"; this.radGridView1.MasterTemplate.Columns.Add(column); GridViewTextBoxColumn textColumn1 = new GridViewTextBoxColumn("Name"); textColumn1.Width = 150; textColumn1.HeaderText = "Name"; this.radGridView1.MasterTemplate.Columns.Add(textColumn1); GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("Salary"); decimalColumn.HeaderText = "Salary"; decimalColumn.FormatString = "${0:#,###}"; this.radGridView1.MasterTemplate.Columns.Add(decimalColumn); GridViewDateTimeColumn dateTimeColumn = new GridViewDateTimeColumn("Hire Date"); dateTimeColumn.Width = 100; dateTimeColumn.TextAlignment = ContentAlignment.MiddleRight; dateTimeColumn.HeaderText = "Hire Date"; this.radGridView1.MasterTemplate.Columns.Add(dateTimeColumn); GridViewTextBoxColumn textColumn2 = new GridViewTextBoxColumn("Title"); textColumn2.Width = 150; textColumn2.HeaderText = "Title"; this.radGridView1.MasterTemplate.Columns.Add(textColumn2); this.radGridView1.MasterTemplate.Columns.Add(new GridViewCheckBoxColumn("Active")); }
private void FormatGrid() { GridViewCheckBoxColumn cbcol = new GridViewCheckBoxColumn(); cbcol.Name = COLS.Check; cbcol.HeaderText = "Active"; cbcol.ReadOnly = false; cbcol.IsVisible = false; cbcol.Width = 80; grdLister.Columns.Add(cbcol); GridViewImageColumn CImage = new GridViewImageColumn(); CImage.Name = COLS.Image; CImage.HeaderText = "Active"; CImage.ReadOnly = true; CImage.Width = 80; grdLister.Columns.Add(CImage); GridViewTextBoxColumn col = new GridViewTextBoxColumn(); col.Name = COLS.Id; col.IsVisible = false; grdLister.Columns.Add(col); col = new GridViewTextBoxColumn(); col.Name = COLS.ShiftName; col.HeaderText = "Shift Name"; col.Width = 190; col.ReadOnly = true; grdLister.Columns.Add(col); col = new GridViewTextBoxColumn(); col.Name = COLS.ShiftStarts; col.HeaderText = "Shift Starts"; col.Width = 160; col.ReadOnly = true; grdLister.Columns.Add(col); col = new GridViewTextBoxColumn(); col.Name = COLS.ShiftEnds; col.HeaderText = "Shift Ends"; col.Width = 160; col.ReadOnly = true; grdLister.Columns.Add(col); GridViewDateTimeColumn dcol = new GridViewDateTimeColumn(); dcol.HeaderText = "From Time"; dcol.IsVisible = false; dcol.Name = COLS.FromTime; dcol.CustomFormat = "HH:mm"; dcol.FormatString = "{0:HH:mm}"; dcol.Width = 120; grdLister.Columns.Add(dcol); dcol = new GridViewDateTimeColumn(); dcol.HeaderText = "Till Time"; dcol.IsVisible = false; dcol.Name = COLS.TillTime; dcol.CustomFormat = "HH:mm"; dcol.FormatString = "{0:HH:mm}"; dcol.Width = 120; grdLister.Columns.Add(dcol); GridViewCommandColumn cmdcol = new GridViewCommandColumn(); cmdcol.Width = 80; cmdcol.Name = "btnEdit"; cmdcol.UseDefaultText = true; cmdcol.ImageLayout = System.Windows.Forms.ImageLayout.Center; cmdcol.DefaultText = "Edit"; cmdcol.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; grdLister.Columns.Add(cmdcol); cmdcol = new GridViewCommandColumn(); cmdcol.Width = 80; cmdcol.Name = "btnDelete"; cmdcol.UseDefaultText = true; cmdcol.ImageLayout = System.Windows.Forms.ImageLayout.Center; cmdcol.DefaultText = "Delete"; cmdcol.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; grdLister.Columns.Add(cmdcol); grdLister.CommandCellClick += GrdDriverShift_CommandCellClick; }
private GridViewDataColumn AppendNewColumn(string columnType, bool numberInTheHeader) { GridViewDataColumn newColumn = null; switch (columnType) { case "Text": newColumn = new GridViewTextBoxColumn(); newColumn.FieldName = "Text"; break; case "NumericText": newColumn = new GridViewMaskBoxColumn(); ((GridViewMaskBoxColumn)newColumn).Mask = "f"; newColumn.TextAlignment = ContentAlignment.MiddleLeft; newColumn.FieldName = "NumericText"; break; case "Decimal": newColumn = new GridViewDecimalColumn(); newColumn.TextAlignment = ContentAlignment.MiddleRight; newColumn.FieldName = "Decimal"; break; case "DateTime": newColumn = new GridViewDateTimeColumn(); newColumn.FormatString = "{0:MM-dd-yyyy}"; newColumn.TextAlignment = ContentAlignment.MiddleRight; newColumn.FieldName = "DateTime"; break; case "Image": newColumn = new GridViewImageColumn(); ((GridViewImageColumn)newColumn).ImageLayout = ImageLayout.Center; newColumn.Width = 40; newColumn.FieldName = "Image"; break; case "ComboBox": newColumn = new GridViewComboBoxColumn(); ((GridViewComboBoxColumn)newColumn).DataSource = this.comboItems; newColumn.Width = 100; newColumn.FieldName = "ComboBox"; break; case "Command": newColumn = new GridViewCommandColumn(); ((GridViewCommandColumn)newColumn).TextAlignment = ContentAlignment.MiddleCenter; newColumn.FieldName = "Command"; break; case "CheckBox": newColumn = new GridViewCheckBoxColumn(); newColumn.Width = 50; newColumn.FieldName = "CheckBox"; break; } if (numberInTheHeader) { newColumn.HeaderText = (this.columnNum++).ToString() + " - " + columnType; } else { newColumn.HeaderText = columnType; } this.radGridView1.Columns.Add(newColumn); return(newColumn); }
protected void CargaGrilla() { RadGridViewVentas.DataSource = new DataTable(); RadGridViewVentas.Columns.Clear(); if (dttVenta.Rows.Count > 0) { RadGridViewVentas.EnableFiltering = true; RadGridViewVentas.AutoGenerateColumns = false; RadGridViewVentas.AllowAddNewRow = false; RadGridViewVentas.MasterTemplate.ShowHeaderCellButtons = true; RadGridViewVentas.MasterTemplate.ShowFilteringRow = false; RadGridViewVentas.TableElement.EndUpdate(); RadGridViewVentas.AllowDeleteRow = false; RadGridViewVentas.AllowRowResize = false; RadGridViewVentas.AllowEditRow = true; RadGridViewVentas.ShowRowHeaderColumn = false; RadGridViewVentas.Select(); RadGridViewVentas.EnableSorting = true; List <int> data = dttVenta.AsEnumerable().Select(Servicio => Servicio.Field <string>("Servicio").Length).ToList(); int WidthText = data.Max(); var col = from dat in dttVenta.AsEnumerable() where dat.Field <string>("Servicio").Length == WidthText select dat; GridViewTextBoxColumn colServicio = new GridViewTextBoxColumn(); colServicio.FieldName = "Servicio"; colServicio.HeaderText = "Servicio"; colServicio.MinWidth = Consulta.AnchoTexto(col.First().Field <string>("Servicio").ToString(), colServicio.HeaderText, RadGridViewVentas.Font); colServicio.Name = "colServicio"; colServicio.ReadOnly = true; RadGridViewVentas.Columns.Add(colServicio); data = dttVenta.AsEnumerable().Select(Producto => Producto.Field <string>("Producto").Length).ToList(); WidthText = data.Max(); col = from dat in dttVenta.AsEnumerable() where dat.Field <string>("Producto").Length == WidthText select dat; GridViewTextBoxColumn colProducto = new GridViewTextBoxColumn(); colProducto.FieldName = "Producto"; colProducto.HeaderText = "Producto"; colProducto.MinWidth = Consulta.AnchoTexto(col.First().Field <string>("Producto").ToString(), colProducto.HeaderText, RadGridViewVentas.Font); colProducto.Name = "colProducto"; colProducto.ReadOnly = true; RadGridViewVentas.Columns.Add(colProducto); data = dttVenta.AsEnumerable().Select(Estilista => Estilista.Field <string>("Estilista").Length).ToList(); WidthText = data.Max(); col = from dat in dttVenta.AsEnumerable() where dat.Field <string>("Estilista").Length == WidthText select dat; GridViewTextBoxColumn colEstilista = new GridViewTextBoxColumn(); colEstilista.FieldName = "Estilista"; colEstilista.HeaderText = "Estilista"; colEstilista.MinWidth = Consulta.AnchoTexto(col.First().Field <string>("Estilista").ToString(), colEstilista.HeaderText, RadGridViewVentas.Font); colEstilista.Name = "colEstilista"; colEstilista.ReadOnly = true; RadGridViewVentas.Columns.Add(colEstilista); data = dttVenta.AsEnumerable().Select(CodigoTrabajo => CodigoTrabajo.Field <string>("CodigoTrabajo").Length).ToList(); WidthText = data.Max(); col = from dat in dttVenta.AsEnumerable() where dat.Field <string>("CodigoTrabajo").Length == WidthText select dat; GridViewTextBoxColumn colCodigoTrabajo = new GridViewTextBoxColumn(); colCodigoTrabajo.FieldName = "CodigoTrabajo"; colCodigoTrabajo.HeaderText = "Baucher"; colCodigoTrabajo.MinWidth = Consulta.AnchoTexto(col.First().Field <string>("CodigoTrabajo").ToString(), colCodigoTrabajo.HeaderText, RadGridViewVentas.Font); colCodigoTrabajo.Name = "colCodigoTrabajo"; colCodigoTrabajo.ReadOnly = true; RadGridViewVentas.Columns.Add(colCodigoTrabajo); data = dttVenta.AsEnumerable().Select(Nombre => Nombre.Field <int>("Cantidad").ToString().Length).ToList(); WidthText = data.Max(); col = from dat in dttVenta.AsEnumerable() where dat.Field <int>("Cantidad").ToString().Length == WidthText select dat; GridViewTextBoxColumn colCantidad = new GridViewTextBoxColumn(); colCantidad.DataType = typeof(decimal); colCantidad.FieldName = "Cantidad"; colCantidad.FormatString = "{0:G}"; colCantidad.HeaderText = "Cantidad"; colCantidad.MinWidth = Consulta.AnchoTexto(col.First().Field <int>("Cantidad").ToString(), colCantidad.HeaderText, RadGridViewVentas.Font); colCantidad.Name = "colCantidad"; colCantidad.ReadOnly = true; RadGridViewVentas.Columns.Add(colCantidad); data = dttVenta.AsEnumerable().Select(Nombre => Nombre.Field <int>("ValorVenta").ToString().Length).ToList(); WidthText = data.Max(); col = from dat in dttVenta.AsEnumerable() where dat.Field <int>("ValorVenta").ToString().Length == WidthText select dat; GridViewTextBoxColumn colValorVenta = new GridViewTextBoxColumn(); colValorVenta.DataType = typeof(decimal); colValorVenta.FieldName = "ValorVenta"; colValorVenta.FormatString = "{0:C}"; colValorVenta.HeaderText = "Valor de Compra"; colValorVenta.MinWidth = Consulta.AnchoTexto(col.First().Field <int>("ValorVenta").ToString(), colValorVenta.HeaderText, RadGridViewVentas.Font); colValorVenta.Name = "colValorVenta"; colValorVenta.ReadOnly = true; RadGridViewVentas.Columns.Add(colValorVenta); GridViewImageColumn colEliminar = new GridViewImageColumn(); colEliminar.HeaderText = "Eliminar"; colEliminar.MinWidth = 50; colEliminar.Name = "colEliminar"; colEliminar.ReadOnly = true; RadGridViewVentas.Columns.Add(colEliminar); RadGridViewVentas.DataSource = dttVenta; } total = 0; foreach (DataRow dtr in dttVenta.Rows) { total += (int.Parse(dtr["Cantidad"].ToString()) * int.Parse(dtr["ValorVenta"].ToString())); } for (int l = 0; l < RadGridViewVentas.Rows.Count; l++) { Bitmap eliminar = new Bitmap(@"Imagenes\shopping-cart-remove-icon (1).png"); RadGridViewVentas.Rows[l].Cells["colEliminar"].Value = eliminar; } RadMskValorTotal.Value = total; Limpiar(); ValidaVenta(); }
protected void CargaGrillaVenta() { RadGridViewVentaDiaria.DataSource = new DataTable(); RadGridViewVentaDiaria.Columns.Clear(); if (dttVentaDia.Rows.Count > 0) { RadGridViewVentaDiaria.EnableFiltering = true; RadGridViewVentaDiaria.AutoGenerateColumns = false; RadGridViewVentaDiaria.AllowAddNewRow = false; RadGridViewVentaDiaria.MasterTemplate.ShowHeaderCellButtons = true; RadGridViewVentaDiaria.MasterTemplate.ShowFilteringRow = false; RadGridViewVentaDiaria.TableElement.EndUpdate(); RadGridViewVentaDiaria.AllowDeleteRow = false; RadGridViewVentaDiaria.AllowRowResize = false; RadGridViewVentaDiaria.AllowEditRow = true; RadGridViewVentaDiaria.ShowRowHeaderColumn = false; RadGridViewVentaDiaria.Select(); RadGridViewVentaDiaria.EnableSorting = true; List <int> data = dttVentaDia.AsEnumerable().Select(Nombre => Nombre.Field <int>("NumeroVentaDia").ToString().Length).ToList(); int WidthText = data.Max(); var col = from dat in dttVentaDia.AsEnumerable() where dat.Field <int>("NumeroVentaDia").ToString().Length == WidthText select dat; GridViewTextBoxColumn colNumeroVentaDia = new GridViewTextBoxColumn(); colNumeroVentaDia.DataType = typeof(decimal); colNumeroVentaDia.FieldName = "NumeroVentaDia"; colNumeroVentaDia.FormatString = "{0:G}"; colNumeroVentaDia.HeaderText = "Numero de Venta"; colNumeroVentaDia.MinWidth = Consulta.AnchoTexto(col.First().Field <int>("NumeroVentaDia").ToString(), colNumeroVentaDia.HeaderText, RadGridViewVentas.Font); colNumeroVentaDia.Name = "colNumeroVentaDia"; colNumeroVentaDia.ReadOnly = true; RadGridViewVentaDiaria.Columns.Add(colNumeroVentaDia); data = dttVentaDia.AsEnumerable().Select(Servicio => Servicio.Field <int>("ValorVenta").ToString().Length).ToList(); WidthText = data.Max(); col = from dat in dttVentaDia.AsEnumerable() where dat.Field <int>("ValorVenta").ToString().Length == WidthText select dat; GridViewTextBoxColumn colValorVenta = new GridViewTextBoxColumn(); colValorVenta.DataType = typeof(decimal); colValorVenta.FieldName = "ValorVenta"; colValorVenta.FormatString = "{0:C}"; colValorVenta.HeaderText = "Valor de Factura"; colValorVenta.MinWidth = Consulta.AnchoTexto(col.First().Field <int>("ValorVenta").ToString(), colValorVenta.HeaderText, RadGridViewVentas.Font); colValorVenta.Name = "colValorVenta"; colValorVenta.ReadOnly = true; RadGridViewVentaDiaria.Columns.Add(colValorVenta); data = dttVentaDia.AsEnumerable().Select(Servicio => Servicio.Field <string>("Fecha").ToString().Length).ToList(); WidthText = data.Max(); col = from dat in dttVentaDia.AsEnumerable() where dat.Field <string>("Fecha").ToString().Length == WidthText select dat; GridViewDateTimeColumn colFecha = new GridViewDateTimeColumn(); colFecha.FieldName = "Fecha"; colFecha.HeaderText = "Fecha"; colFecha.MinWidth = Consulta.AnchoTexto(col.First().Field <string>("Fecha").ToString(), colFecha.HeaderText, RadGridViewVentaDiaria.Font); colFecha.Name = "colFecha"; colFecha.ReadOnly = true; RadGridViewVentaDiaria.Columns.Add(colFecha); GridViewImageColumn colEliminar = new GridViewImageColumn(); colEliminar.HeaderText = "Eliminar"; colEliminar.MinWidth = 50; colEliminar.Name = "colEliminar"; colEliminar.ReadOnly = true; RadGridViewVentaDiaria.Columns.Add(colEliminar); RadGridViewVentaDiaria.DataSource = dttVentaDia; for (int l = 0; l < RadGridViewVentaDiaria.Rows.Count; l++) { Bitmap eliminar = new Bitmap(@"Imagenes\shopping-cart-remove-icon (1).png"); RadGridViewVentaDiaria.Rows[l].Cells["colEliminar"].Value = eliminar; } } }
private void BindGrid() { this.employeesTableAdapter.Fill(this.nwindDataSet.Employees); this.radGridView1.MasterTemplate.AutoGenerateColumns = false; radGridView1.DataSource = this.nwindDataSet.Employees; GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn(); decimalColumn.FieldName = "EmployeeID"; decimalColumn.Name = "EmployeeID"; decimalColumn.HeaderText = "Decimal"; decimalColumn.DecimalPlaces = 0; decimalColumn.Width = 100; decimalColumn.IsVisible = false; this.radGridView1.Columns.Add(decimalColumn); GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.FieldName = "LastName"; textBoxColumn.Name = "LastName"; textBoxColumn.HeaderText = "Text"; textBoxColumn.Width = 100; textBoxColumn.IsVisible = false; this.radGridView1.Columns.Add(textBoxColumn); GridViewImageColumn imageColumn = new GridViewImageColumn(); imageColumn.FieldName = "Photo"; imageColumn.Name = "Photo"; imageColumn.HeaderText = "Image"; imageColumn.ImageLayout = ImageLayout.Zoom; imageColumn.Width = 54; this.radGridView1.Columns.Add(imageColumn); GridViewComboBoxColumn lookUpColumn = new GridViewComboBoxColumn(); lookUpColumn.FieldName = "TitleOfCourtesy"; lookUpColumn.Name = "LookUp"; lookUpColumn.HeaderText = "LookUp"; lookUpColumn.DataSource = new string[] { "Mr.", "Mrs.", "Dr.", "Ms." }; lookUpColumn.Width = 100; lookUpColumn.IsVisible = false; this.radGridView1.Columns.Add(lookUpColumn); GridViewMaskBoxColumn maskBoxColumn = new GridViewMaskBoxColumn(); maskBoxColumn.FieldName = "HomePhone"; maskBoxColumn.Name = "MaskBox"; maskBoxColumn.HeaderText = "MaskBox"; maskBoxColumn.MaskType = MaskType.Standard; maskBoxColumn.Mask = "(###) ###-####"; maskBoxColumn.Width = 200; maskBoxColumn.IsVisible = false; this.radGridView1.Columns.Add(maskBoxColumn); GridViewHyperlinkColumn hyperlinkColumn = new GridViewHyperlinkColumn("Hyperlink"); hyperlinkColumn.ReadOnly = true; hyperlinkColumn.Width = 200; this.radGridView1.Columns.Add(hyperlinkColumn); GridViewColorColumn colorColumn = new GridViewColorColumn("Color"); colorColumn.Width = 100; this.radGridView1.Columns.Add(colorColumn); GridViewCalculatorColumn calculatorColumn = new GridViewCalculatorColumn("Calculator"); calculatorColumn.Width = 80; this.radGridView1.Columns.Add(calculatorColumn); GridViewBrowseColumn browseColumn = new GridViewBrowseColumn("Browse"); browseColumn.Width = 180; this.radGridView1.Columns.Add(browseColumn); GridViewCheckBoxColumn checkBoxColumn = new GridViewCheckBoxColumn(); checkBoxColumn.HeaderText = "CheckBox"; checkBoxColumn.Name = "CheckBox"; checkBoxColumn.Width = 100; checkBoxColumn.IsVisible = false; this.radGridView1.Columns.Add(checkBoxColumn); GridViewDataColumn commandColumn = new GridViewTextBoxColumn(); commandColumn.HeaderText = "Custom"; commandColumn.Name = "ProgressBar"; commandColumn.DataType = typeof(int); commandColumn.ReadOnly = true; commandColumn.Width = 100; this.radGridView1.Columns.Add(commandColumn); this.PopulateUnboundColumns(); }