This is a migrated thread and some comments may be shown as answers.

Asking for User Input in the Controller?

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin
Top achievements
Rank 1
Kevin asked on 20 Sep 2011, 02:00 AM

I wanted to get your opinion on best practices for getting user input while doing something in a controller. I am inside a Action method in my controller and I am processing some data. The data may force me to ask the user for further input, based on that input I will then do something with that data.

What is the best practice to go about this?

1) How do I issue an alert or confirm box to get user input from the Controller? This Action is initiated by an update button on a Telerik MVC grid.

2) How do I persist my data from initially processing it, to asking the user for input, and then continue processing the data? It's a fair amount of data.

If the initial request was started from a ajax call in a javascript function, I think I would know how to do this. I would probably have the Action method pass back a JSON object back to the javascript method that would in turn ask the user and then decide which controller action to call and then pass this json object to it.

Am I on the right track here? If so, my problem would be with the Telerik MVC grid. I would need the update event of my grid to be bound client side.

Any help or thoughts on this is appreciated.

Steve

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 20 Sep 2011, 09:30 PM
So I can do this by cancelling the OnSave server-side controller action by using "e.preventDefault();" in the OnSave client event.  So now I can do all the updating on client-side the with ajax calls, etc.  HOWEVER: When I am done, how to I change the edited row back to it's display state, preserving any changes that were made?

Steve
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Share this question
or