C# | Authorize.net AIM form submit progress indicator - c#

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.

Related

Asp.net MVC 4 Keep TempData only on Page refresh?

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!

Ability to navigate back with browser button without showing control alerts message boxs that appearing in the middle of the navigation process

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;)

How to pause code execution?

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.

C# How to determine a status of a Form

I have a tray app that starts ( Form 1 ) and shows on right click a "Login" menu strip item.
On click, I setup a Form 2, asking for user and pass.
On a successful authentication, I'd like to close Form 2 and continue with Form 1 ( ie. I would like to start a timer ).
I was thinking of just setting up a timer which would check the Form 2 status ( basically a getter function inside Form 2 ).
Still, I think there has to be an easier way than having something tick.
I dont think you need a timer or any thing for that just show the form as a Modal Dialogue and return to main form when closed.
You should show the login form using the ShowDialog method.
This method shows a modal dialog which will prevent the user from interacting with the rest of your application until the dialog is closed.
You should then perform authentication in the login form's button click handler, and close the form when it's successful.

Delaying or briefly pausing windows messages

I have a Winforms DataGridView in my application. When the user selects a row and hits enter, I load a new form with details related to that row. It takes about a second to get the data and show the screen. Some of the users are pretty fast and they start entering keystrokes relevant to the form e.g Pg Down/Pg Up, even before it loads and complain that the grid scrolls down instead of seeing the intended effect on the loaded Form.
I need a way to pause the keystroke messages from being processed until the form is loaded. Any ideas highly appreciated.
You could capture the WM_KEYDOWN message and ignore it if the form is loading (perhaps setting a flag) or you could post the messages to the currently loading form.
Have a look at IMessageFilter
Not a solution but a different approach:
what do you do now when the user selects a row and hit enter?:
Show form and load data
load data and show form
Option 1 is best combined with a loading icon/message. If you really have to enable the keystrokes then capture them and refire them when you are done loading. The new form will receive the keystrokes because it's topmost and active (if done correctly).
Can you not set the enabled property to false, and back to true once the data has loaded?
A simple bool check should do.
Create a bool, name it 'busy', and when the enter button is pressed check it to true.
if (!busy)
{
busy = true;
//do your thing
}
Simply check it back to false again when the loading is finished

Categories