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.
Related
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!
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'm taking a whack at WPF and trying to learn as I go. I'd appreciate any advice offered.
I've got a Window that has a Page attached to it (through a Frame on the Window). When you press a button on the Page, I want a custom window to pop up to present several custom options and be displayed in a manner of my choosing (I'm thinking right now I want it to be a grid but that may change as I go on). When selected, the modal window will disappear and return to the calling method (button press from the Page) the value of the selected choice.
I don't want the standard windows dialog box with the options of yes, no, okay, cancel, or anything like that. This is truly just a custom popup that returns a value to the caller when the user makes their selection on the popup.
Create a new Window subclass, which you can layout however you like. Then in your button click event handler, display it modally using myModalWindow.ShowDialog();. You can then have a property on the window class which you can access after it closes in order to access result data, i.e.:
myModalWindow.ShowDialog();
var data = myModalWindow.SomeResultProperty;
If you really want to have something returned from a method, I suppose you could create your own public method on your window class which internally calls ShowDialog() and then returns a value.
I would like to close a modal form when the user clicks outside (anywhere on the computer desktop) the modal form. How can we do this as a modal form is not meant to lose focus.
You need to hook mouse (and keyboard if required) and capture their events. Then check if the click happened outside the form (and area). If yes, flag a sign which can be read by the model form that it can close down.
Algo:
Hook mouse click event.
When callback function is called, check for the click position - if it's inside your form or not (you might need to translate the locations to Desktop locations - I hope you know how to!)
If the point is outside the form, set a flag (boolean or anything that makes you happy). Make sure the form can read the flag somehow.
Trigger an event for form to capture. In it's handler read the flag status. If true, close/unload the form.
This page will tell you technical details and functions.
I don't think you need to make it modal... then you can take siride's option of closing it on the Deactivate event.
The reason you don't need to make it modal: The first time you display it, it will have the focus and be topmost. Modal prevents you from clicking somewhere else, but you want to be able to click somewhere else... and when you do, the form goes away, so there are no modal needs.
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