I have a C#.NET web app and would like to save my underlying Model anytime the user navigates off a View. I am using the .Net Entity Framework witha DbContext object. How would I implement a Save on Navigation?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
All….thanks for the comments. It was educational. Using the info provided regarding forms and posts, I used buttons to do poast and investigated their valuse to decide what action to perform.
On the Views that had navigation links, I swapped in the input buttons and used CSS to make them look and act like hyperlinks.
and
The Task Controller has “NavSave” as a parameter into the Edit [POST]….and the value is either “Create SubTask” or “Delete SubTask”. In the controller, I check if “NavSave” is null or not….if not, I then examine the value. If “Create SubTask”, I save the Task Model and navigate to the Subtask Create[GET] method. If “DeleteSubTask”, I save the Task Model and navigate to the Subtask Delete[GET] method. In order to do this, I also have a hidden field containing the SubTask id….so when I Navigate to the Delete[Get] method, I know which SubTask to delete.
Give comments if you like…