Current filter:
                                You should refresh the page.
                                  • I have a dashboardview with a simpleAction like this in a view controller:

                                    [C#]
                                    private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e) { XafApplication app = Application; IObjectSpace os = app.CreateObjectSpace(); ShowViewParameters svp = new ShowViewParameters(); DialogController dialog = new DialogController(); Evento evento = os.CreateObject<Evento>(); evento.Descripcion = "PVXXXX - ........."; svp.CreatedView = Application.CreateDetailView(os, evento); svp.TargetWindow = TargetWindow.NewModalWindow; svp.Context = TemplateContext.PopupWindow; dialog.Accepting += CrearEvento; svp.Controllers.Add(dialog); Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null)); }

                                    The dialog accepting method is:

                                    [C#]
                                    private void CrearEvento(object sender, DialogControllerAcceptingEventArgs e) { Evento evento = (Evento)((DialogController)sender).Frame.View.CurrentObject; var myEvent = ObjectSpace.CreateObject<Event>(); myEvent.StartOn = DateTime.Now; myEvent.EndOn = DateTime.Now.AddHours(1); myEvent.Description = evento.Descripcion; ObjectSpace.CommitChanges(); // I want to refresh the dashboard, but I can't }

                                    I want to refresh the dashboard after de dialog accepting method is executed. How can I refresh the dashboard? If I hit refresh button after executing action, new data is shown.

                                    Thanks!

                                1 Solution

                                Creation Date Importance Sort by
                                Hi Juan,

                                You can invoke the Refresh action manually in your code.

                                [C#]
                                Frame.GetController<RefreshController>().RefreshAction.DoExecute();
                                • Juan Pallas Ribes 02.12.2019
                                  If the action is in a controller of a listview's dashboard, how can I access the refresh action of the dashboard?
                                • Gosha (DevExpress Support) 02.12.2019
                                  Juan,

                                  There is no easy way to access the Dashboard View Frame from its item Frame. In this scenario, I suggest you use the same code as our Refresh action uses. It just refreshes all Dashboard View Item Frames:


                                  [C#]
                                  NestedFrame nestedFrame = (NestedFrame)Frame; CompositeView view = nestedFrame.ViewItem.View; foreach (IFrameContainer frameContainer in view.GetItems<IFrameContainer>()) { if ((frameContainer.Frame != null) && (frameContainer.Frame.View != null) && (frameContainer.Frame.View.ObjectSpace != null)) { frameContainer.Frame.View.ObjectSpace.Refresh(); } }
                                • Juan Pallas Ribes 02.12.2019
                                  Thanks, this solution is perfect for me.
                                • Gosha (DevExpress Support) 02.12.2019
                                  My pleasure, Juan!