protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { GridEditableItem editedItem = e.Item as GridEditableItem; UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); long GroupMAId = Convert.ToInt32((userControl.FindControl("txtGroupMAId") as RadTextBox).Text.Trim()); GroupMA gma = new GroupMA(); if (gma.LoadByPrimaryKey(GroupMAId)) { try { gma.GtCode = (userControl.FindControl("txtGroupMACode") as RadTextBox).Text.ToUpper(); gma.UserUpdate = "toro"; gma.TglUpdate = DateTime.Now; gma.Save(); } catch (Exception ex) { string es = ex.Message; e.Canceled = true; } finally { RadGrid1.Rebind(); } } }
protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { GridEditableItem editedItem = e.Item as GridEditableItem; UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); GroupMA gma = new GroupMA(); try { gma.GtCode = (userControl.FindControl("txtGroupMACode") as RadTextBox).Text.ToUpper(); gma.UserInsert = "toro"; gma.TglInsert = DateTime.Now; gma.Save(); } catch (Exception ex) { string es = ex.Message; e.Canceled = true; } finally { RadGrid1.Rebind(); } }