I have requirement, I am showing a Menu on the right side of the partial view in MVC. I do have edit mode and view mode, in the view. When I am in edit mode, I want to ask a confirmation message to navigate or not, on the click of the menu links. Somebody please help me on this.
Asked
Active
Viewed 36 times
-1
-
1Sample code please, no one can help without looking at your code. – Mohammed Swillam Dec 04 '14 at 08:24
-
[window.confirm](http://www.w3schools.com/jsref/met_win_confirm.asp) – Dec 04 '14 at 08:35
1 Answers
0
You could store a session variable that indicates if you can navigate away without confirmation, which you could set to false when calling the edit views. Edit: if you don't like session, you could also use the localStorage

sander
- 719
- 2
- 9
- 21
-
how can i handle those clicks? i need to perform a javascript or MVC code before the navigation – Koundinya Challa Dec 04 '14 at 08:39
-
The clicks you catch with jQuery (http://stackoverflow.com/questions/15234881/how-to-catch-any-click-event-in-jquery) When you catched it, you can check for the parameter in session (http://stackoverflow.com/questions/560084/session-variables-in-asp-net-mvc - second answer) or localStorage and popup the confirm. A little bit of javascript knowledge is needed for this, but this is pretty basic. – sander Dec 04 '14 at 08:47