I am using a dialog box to confirm an action that requires an override by a user's supervisor. When the dialog box pops open the form values are pre-populated with TempData in the view and the text boxes are locked (disabled); except for the text box the supervisor uses. The logic is set to deactivate the lock upon a submit, cancel, or on close event of the dialog box. So the next time the user opens the dialog the text boxes will be enabled and blank for a new submission.
Now, in the event a user refreshes the page (for whatever reason that may be) while the dialog box is opened and in the locked state, the TempData value life cycle ends and when the dialog box is reopened, then the text boxes are in the locked state but empty. So the system is ready to submit a form with a supervisor approval that has empty values.
Now, my question is, on a page refresh, is there some final method that is called to where I can call keep on the TempData? Or what is the best way to retain the TempData only in the event of a page refresh? thanks!
Related
I have a row of buttons on a web page, each of which is to invoke a Model dialogue to display further details. I am displaying the modal dialogue thus:-
winArgs = window.showModalDialog('MyDialogue.aspx', winArgs, winSettings);
and when I do this, the codebehind detects the data it is supposed to display and displays it on the Modal dialogue. I then close this down with the red X, and click another button to display a different dataset, but no codebehind methods are invoked, and consequently the dialogue displays the previous dataset.
I guess there is nothing that can be done about this on closing (that is a client event), so what I need to know is how do I either:-
create a new modal dialogue with the showModalDialog and not re-use the existing one,
or, invoke some function in the code-behind when the dialogue pops up?
I am searching for techniques/ approaches to solve this problem:
dummy scenĂ¡rio:
In main page I have a button. when I click on it, it display a message: "are you sure?"
when I click ok... it redirect me for secondary page. Now if I want to go back, I click in back button of the browser... my intended behavior is to the application go to main page... but instead it show the alert box "are you sure"...
the same appens in forms...when I click back the application keep point me to the previous input instead of go to the previous page.
I suppose that is a dummy question... but for this context I don't have the knowledge for "googling" the right Keywords... so point me in the right direction it will be a huge Help;)
I have an ASP.NET web app that uses a single page, but makes some controls invisible and others visible throughout the workflow. It's a fairly simple application, which is why it just uses one page.
I'm not sure though how to reload the page when a user clicks a cancel button, or when they complete the workflow. Here's some details about the application workflow...
The page loads and displays a LoginTable control with a dropdown list with employee names, and a pinpad where a pin number is entered for the selected employee, and a login button.
On clicking the login button, a postback occurs where the pin is validated, and if valid, the Table control that holds most of the page contents (except the header) gets made invisible, and a new Table control gets made visible depending on the current status (clocked in or out).
At this point, either the ClockInTable or ClockOutTable control are visible, and the LoginTable control is invisible. The user can either click a Cancel button, or a Clock In / Out button (with some other things to select if clocking in, like work site and job).
What I want is, when the user either clicks the Cancel, Clock In or Clock Out buttons (after any other processing on postback), for the page to load again with a new session and showing the main LoginTable again just as if the user had restarted the browser and opened the page for the first time.
I've tried using Session.Abandon(), and then in the Global.asax Session_End event, I do
Response.Redirect("Login.aspx");
This doesn't work though; it still just reloads the same view of the page.
How do you reload the page (not refresh the page) as if it were the first access (i.e. not a postback)?
Also, I'm new to ASP.NET, so if I'm misunderstanding how a session works, please let me know.
Have you tried Response.Redirect()-ing the user to the same page? That should load the page as if it were a new one. It won't lose the session data though.
I'm not exactly sure you can do that the way you describe. However, what you can do is have a flag as a session variable. Call it say IsFirstComer. I'm not sure how the workflow of your system goes, but you can have it reset to true every time a new user logs in (hasn't started a workflow yet), or has exited a workflow (needs to start all over again), but as soon as te user has started the workflow you set it to false. Your controls behaviour can then be controlled through the value of IsFirstComer.
Have you write: if(!this.IsPostback) in the Page_Load method, after that try "Response.Redirect(page.aspx)" again.
I have datagrid, when press update button I made popup window. I want to pause update process while user fills popup window.
You should start the Update only when you have all required info, not before the user fills in data in the popup window.
the first phase would be data capturing from user input, then you validate the data are correct, valid and sufficient and only then you start the update process whatever it means to you (you have given too few details...)
You can do it with Javascript. First you should capture the event and return false. This prevents a postback. When the dialog is completely filled out and closed you can send the information to the server via as ajax call or trigger a traditional post.
When I click the purchase button for the form I want the buttons text to change to processing... and have it be disabled while the form is waiting for a response back from authorize.net. Once the response comes back, return the button text to purchase and make it enabled. I do have two labels that are initially blank and once authorize.net returns a status it populates those labels with the correct response.
All of my authorize.net code is in a method called cc_Submit. Thanks.
I decided that I could program against my update panel progress indicator.