I ran a store procedure in OnSaved method of a view. In the store procedure, i updated some field of the onsaved selected record and it can't reflected those on view UI.
How to refresh the view in OnSaved? Pls help
OnSaved view refresh
Answers approved by DevExpress Support
UPDATED:
You need to move the stored procedure execution to the ViewController, because the OnSaved method is not suitable for this task. In that case, the following code will work correctly:
CodeDevExpress.Xpo.DB.SelectedData a = ((XPObjectSpace)ObjectSpace).Session.ExecuteSproc("sp_Batchupd", new OperandValue(Convert.ToInt32(BatchID)));
this.ObjectSpace.Refresh();
---------------------------------
Hello,
Please try approaches described in the following threads and let us know if you need further assistance:
Refresh view is not working
Refresh ListView
refresh detailview
See also:
ObjectSpace.Committed
I have attached the modified sample to illustrate this approach.
Please review it and let me know if you need further assistance.
Hello,
You implementation is unclear to me. Would you please send us a simple sample that illustrates how you execute a store procedure in еру OnSaved method of a view?
Also I suggest you review the following threads:
How to auto refresh a listview?
How to implement auto refresh functionality on the Web
Pls check below for sample.
after exec sp_BatchDetailupd, there are some fields was updated and i want to refresh the grid after sp execution. pls help . thx
protected override void OnSaved()
{
base.OnSaved();
DevExpress.Xpo.DB.SelectedData a = Session.ExecuteSproc("sp_BatchDetailupd", new OperandValue(Convert.ToInt32(BatchDetailID)));
DevExpress.Xpo.DB.SelectedData b = Session.ExecuteSproc("spCreatePayroll_ALL", new OperandValue(Convert.ToInt32(EmployeeID.EmployeeID)), new OperandValue(Convert.ToInt32(BatchID.BatchID)), new OperandValue(Convert.ToInt32(BatchDetailID)));
}