or
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
;
this
.grdContrato.CurrentCell.Value = buscarForm.CodigoSeleccionado;
but do not work.private
void
uiProductsGrid_CommandCellClick(
object
sender, EventArgs e)
{
GridCommandCellElement button = (GridCommandCellElement) sender;
if
(button.RowInfo.HierarchyLevel == 1)
{
DataRowView drv = (DataRowView)button.RowInfo.DataBoundItem;
Guid id = (Guid)drv[
"Id"
];
Selection.DeleteSelection(id);
button.MasterTemplate.Rows.Remove(button.RowInfo);
return
;
}
if
(button.RowInfo.HierarchyLevel ==2)
{
Guid id = Guid.Parse(button.RowInfo.Cells[
"Id"
].Value.ToString());
Product.DeleteProduct(id);
// What do I put here to remove this row from the grid???
return
;
}
}
RadButtonElement
radButtonElement = new RadButtonElement();
radButtonElement .Click +=
new EventHandler(radButtonElement _Click);
e.CellElement.Children.Add(radButtonElement );
The problem i am facing is when the Grid is getting filled it is displaying the Button in the Grid.But when i click on it for the first time it is not firing the radButtonElement _Click event. When i click second time it is firing.
Could you suggest me how to fire the click element for the first time only.