Last post Jul 20, 2017 02:20 PM by AdvanceSoftware
Jul 20, 2017 12:34 PM|AdvanceSoftware|LINK
Hi, I know the approach to this has to be a little different.
During the execution of a code behind event, e.g when button clicked "complete task".
I need to take various actions depending on a user input during the server side flow. Here is a simple example..
So during the c# function I take the current record ID and gather some related database information, I need to either take action A or Action B depending on an input from the user.
So am I on the correct track to say I will actually need 3 functions.
1 - Button click (complete)
I will have to come to the end of this function when I need to run a client side confirmation, there is no way around this.. then depending on the button run either the 2 below.
In a desktop application the 1 function would do but am I correct with this?
2 - Function (action a)
3 - Function (action b).
Jul 20, 2017 01:33 PM|PatriceSc|LINK
Desktop is different. You can show something to the user at any time while the web is based on a request/response model. So during a request you can't ask further information without sending back a response first.
It really depends on which kind of confirmation you need. If applicable you usually try to gather all the needed information before triggering the request/response (for example if you just ask for a deletion confirmation)
If what to do next depends on some complex server side processing depending on user input the scheme could be :
- the user triggers the action client side, parameters are gathered and an Ajax function is called
- the result is used to show a confirmation dialog or whatever with the relevant information
- and at this step you can do a full posback or whatever depending on what the user answered
In short you are doing a first request/response to show the confirmation dialog and a second reques/response for the final processing.
Jul 20, 2017 02:20 PM|AdvanceSoftware|LINK
Brilliant answer, thanks, that helps immensley.