Download the Fortunate Library Here:
Fortunate Library 32bit - Stand-Alone Install
Fortunate Library 64bit - Stand-Alone Install
Fortunate Library Solution - Source Code
Sample Code: AddControlToMonitor
The AddControltoMonitor method allows you to add as many controls as you'd like one after the other. If any of the control's values change and a user attempts to leave the page before saving the changes they are prompted to save changes.
Adding controls to monitor is simple:
Of course if you have more than one button on the page you may not want more than one button to trigger this alert. If there is a control that is going to cause a post back or page change which you don't want this alert raised for you can exclude a control like so:
Sample Code: AttachConfirmation
Pops up confirmation dialog with a message of your choice requesting that the user verify the action.
Sample Code: AttachDisableSubmit
Disables the submit button after a successful submit in order to keep more than one post back from occurring.
Sample Code: AttachWindowPopUp
Attaches a pop-up window to the page event of your choice. Opens a centered pop-up window with dimensions and settings of your choice.
Sample Code: ScrollToElement
ASP.NET has had SmartNavigation which may be used to maintain a user's place on a page during postbacks. But many people have reported SmartNavigation as being very buggy and my own experiences using it have not been consistent. To give the same type of effect I created this method which scrolls a user directly to the input element:
If an element is contained within another element that has it's own scroll bars like a scrolling div then include the name of the outer element:
Sample Code: SetFocus
Set's focus on the control entered.
Sample Code: TextBoxEnterEventHandler
Any text box and button may be hooked up so that pressing enter in the text box causes the associated button to be clicked.