Hello, i'm trying to validate a cell in the CellValidating event,but i have this problem.
When i enter the any value in the cell, i search in database por entered by the user.
For example the user entered x3
i have this code
And when the event ends, the e.value have x3, but the contrato.Detalle[e.RowIndex].ArticuloId have the real code "x3450".
the contrato.Detalle[index].ArticuloId,is the property of the BindingList<>, and this bound to the gridview.
But when the event ends, the contrato.Detalle[e.RowIndex].ArticuloId have the x3 againg.
Whow i can set to e.value , so that the event ends the cell have the value x3450 and not the user entered value
i try with
Tanks
When i enter the any value in the cell, i search in database por entered by the user.
For example the user entered x3
i have this code
case "Codigo": if (grdContrato.IsInEditMode && e.Value != null) { ArticuloEntity articulo = new ArticuloEntity(); articulo = ArticuloNeg.ObtenerArticuloById(e.Value.ToString()); if (!string.IsNullOrEmpty(articulo.ArticuloId)) { this.grdContrato.CurrentCell.Value=articulo.ArticuloId; contrato.Detalle[e.RowIndex].ArticuloId = articulo.ArticuloId; contrato.Detalle[e.RowIndex].Descripcion = articulo.Descripcion; } else { BuscarArticulosForm buscarForm = new BuscarArticulosForm(e.Value.ToString(), "Codigo"); buscarForm.ShowDialog(); if (!string.IsNullOrEmpty(buscarForm.CodigoSeleccionado)) { this.grdContrato.CurrentCell.Value = buscarForm.CodigoSeleccionado; contrato.Detalle[e.RowIndex].ArticuloId = buscarForm.CodigoSeleccionado; contrato.Detalle[e.RowIndex].Descripcion = buscarForm.ArticuloSeleccionado; } } } break;And when the event ends, the e.value have x3, but the contrato.Detalle[e.RowIndex].ArticuloId have the real code "x3450".
the contrato.Detalle[index].ArticuloId,is the property of the BindingList<>, and this bound to the gridview.
But when the event ends, the contrato.Detalle[e.RowIndex].ArticuloId have the x3 againg.
Whow i can set to e.value , so that the event ends the cell have the value x3450 and not the user entered value
i try with
this.grdContrato.CurrentCell.Value = buscarForm.CodigoSeleccionado; but do not work.Tanks