public void OnRowEditCanceled(RowEditCanceledEventArgs args) { EventHandler <RowEditCanceledEventArgs> handler = RowEditCanceled; if (handler != null) { handler(this, args); } }
private void HandleEditCommand(LinkButton linkButton, Int32 bodyRowIndex) { var editingRowMode = GetEditingRowMode(); var dataCellsList = CellsList.Body.GetDataCellsList(bodyRowIndex) as DataCellsList; if (editingRowMode == EditingRowMode.None) { var args = new RowEditingEventArgs(bodyRowIndex, (Parent as RepeaterItem).ItemIndex, dataCellsList); CellsList.Body.GridControl.OnRowEditing(args); SetEditingRowMode(EditingRowMode.Editing, bodyRowIndex); lbAction.Text = "Update"; lbAction.CssClass = "button update"; foreach (RepeaterItem i in dataCellsList.RptCells.Items) { var dataCellControl = i.FindControl("cell") as DataCellControl; if (dataCellControl != null && dataCellControl.DataInputType != DataInputTypes.None) { dataCellControl.SetDisplayAsInputMode(); } } } else { if (linkButton == lbAction) { var args = new RowEditedEventArgs(bodyRowIndex, dataCellsList); DataCellControl dcc; for (var i = 0; i < dataCellsList.RptCells.Items.Count; i++) { dcc = (dataCellsList.GetCell(i) as DataCellControl); if (dcc.DataInputType != DataInputTypes.None) { dcc.UpdatePrevValue(); } } CellsList.Body.GridControl.OnRowEdited(args); } else if (linkButton == lbCancel) { var args = new RowEditCanceledEventArgs(bodyRowIndex, dataCellsList); dataCellsList.RecoverInputState(); CellsList.Body.GridControl.OnRowEditCanceled(args); } SetDefaultDisplayMode(bodyRowIndex); } }
protected void grid_RowEditCanceled(Object sender, RowEditCanceledEventArgs e) { var id = e.DataCellsList.GetCell(0).GetPropertyValue("Value"); var obj = new clsData(); obj.strSql = "select * from tblTestimonials where pk_TestimonialID = " + id; var dt = obj.GetDataTable(); var cell = e.DataCellsList.GetCell(1); var value = dt.Rows[0]["ImagePath"] as String; if (value.HasText()) { value = String.Format("<div class='image'><img src='{0}' style='max-width: 40px;' /></div>", ResolveUrl(value)); } cell.GetType().GetProperty("Value").SetValue(cell, value); }
protected void grid_RowEditCanceled(Object sender, RowEditCanceledEventArgs e) { var value = e.DataCellsList.GetCell(4).GetPropertyValue("PrevValue"); e.DataCellsList.GetCell(4).GetType().GetProperty("Value").SetValue(e.DataCellsList.GetCell(4), value); }