0

In Microsoft's Toolkit DataForm

User is trying to add a new item in Toolkit Dataform by clicking Add icon. In the middle if he selects any other menu tab, then he is going to lose all the entered info.

I want to show promt to User to Save When Leaving a Page. Like Warning user before leaving page with unsaved changes.

ravella
  • 116
  • 2
  • 10

1 Answers1

0

After some research I found the solution.

Theere is a Method called OnNavigatingFrom in Silverlight page. that methods is Called just before a page is no longer the active page in a frame.

So you can add any alert or confirm message in that methods.

protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            if (DataForm.IsEditMode)
            {
                System.Windows.Browser.HtmlPage.Window.Alert("Please Save or Cancel changes before switching the page"); 
                e.Cancel = true;
            }
            base.OnNavigatingFrom(e);
        }

that will be called when you want to move to other page from current page edit or add mode.

ravella
  • 116
  • 2
  • 10