Ticket Q578113
Visible to All Users

OnSaved view refresh

created 11 years ago

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

Comments (2)
DevExpress Support Team 11 years ago

    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)));

      }

      Answers approved by DevExpress Support

      created 11 years ago (modified 6 years ago)

      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:

      Code
      DevExpress.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

        Show previous comments (18)
        DevExpress Support Team 11 years ago

          I have attached the modified sample to illustrate this approach.
          Please review it and let me know if you need further assistance.

            Works like charm. thx so much for your support

            DevExpress Support Team 11 years ago

              You're welcome.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.