stlaural
Jan 24th, 2011, 12:22 PM
Hi all,
I'm currently working on an ASP.NET MVC1 web application and we have a page, a timesheet, that the user use to enter his the time he passed working on his tasks. The problem we are having right now is that the session's timeout is 20min and we don't want to change it. With the timesheet page though, a lot of users simply open it, start entering some time entries, go do someting else and then come back etc... during that their session timed out and as they didn't saved, they lost their entries.
I would like to implement an auto-save feature, like saving the timesheet no matter what, every 2 minutes.
Edit : Like the auto-save that you get when you are editing a document on google docs.
So I'm trying to find the best approach. We already have a controller action that validates and save the timesheet data when the user clicks the save button (using Html.ActionLink) so I would like to call the same action but from a timer_tick event handler if possible. Right now the only way I can think of is using Ajax to call the proper controller action, but I just don't like it, I find it hard to read and maintain for the next guy who will have to work on that. I would have like to simply had a timer and call the controller's action from the behind code I haven't been able to figure out how yet.
Edit : The action that is currently called does some validations and returns a view. Also, the parameters that needs to be sent to the Action are the current Dataview and an "action" which comes from an enum, so I'm not sure that it is accessible from JQuery. In other words, If I don't find a work around solution I guess I'll have good refactoring to do.
So I'm basically taking any suggestion on how to implement the auto-save.
Thanks
I'm currently working on an ASP.NET MVC1 web application and we have a page, a timesheet, that the user use to enter his the time he passed working on his tasks. The problem we are having right now is that the session's timeout is 20min and we don't want to change it. With the timesheet page though, a lot of users simply open it, start entering some time entries, go do someting else and then come back etc... during that their session timed out and as they didn't saved, they lost their entries.
I would like to implement an auto-save feature, like saving the timesheet no matter what, every 2 minutes.
Edit : Like the auto-save that you get when you are editing a document on google docs.
So I'm trying to find the best approach. We already have a controller action that validates and save the timesheet data when the user clicks the save button (using Html.ActionLink) so I would like to call the same action but from a timer_tick event handler if possible. Right now the only way I can think of is using Ajax to call the proper controller action, but I just don't like it, I find it hard to read and maintain for the next guy who will have to work on that. I would have like to simply had a timer and call the controller's action from the behind code I haven't been able to figure out how yet.
Edit : The action that is currently called does some validations and returns a view. Also, the parameters that needs to be sent to the Action are the current Dataview and an "action" which comes from an enum, so I'm not sure that it is accessible from JQuery. In other words, If I don't find a work around solution I guess I'll have good refactoring to do.
So I'm basically taking any suggestion on how to implement the auto-save.
Thanks