Showing a "loading" Message box asp.net - c#

I have an asp application,(online form) and all of the textboxes are disabled, now I ask the user to enter the policy number and an issuance office (which is a dropdown), and it is being read in the database, so when the data provided by the user, the textboxes are enabled, now, when the user clicks on the right issuance office on the drop down list (selected index changed) it searches the records on the database, now i want to prompt the user on selected index change, a message box that would show ("Please wait while we search your record") and close the dialog box when its finish searching from the database.

you cannot do "Message boxes" like you are thinking. you would need to use a modal popup dialog which ASP.NET AJAX has:
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ModalPopup/ModalPopup.aspx
you can also use JQuery to achieve the same thing but it would be clientside based:
http://www.malsup.com/jquery/block/
How to use jquery blockUI
This will do what you are wanting to.

Related

ASP.Net webforms: how to cancel a pending update to input controls

I'm using c#/Asp.Net webforms to collect data in a long form.
I'm using standard Asp.Net validation controls/techniques.
The form is split into several parts (wizard style). The user completes one section before being allowed to go onto the next section.
Each completed section has an Edit button, so the user can go back at any point and make changes to a previous section's data.
Currently there is only a 'continue' button available in edit mode, When the user chooses edit, make changes, then clicks 'continue', the data is re-validated and the user returned to the original position if successful.
However, this does not cover all scenarios. Suppose the user updates a textbox or dropdown option then decides to revert back to the original data.
At present they would need to manually reset the data back to the original state before clicking continue. Not ideal.
The answer would be to introduce a cancel button. The button event should ignore any changes to the data and simply return back to the original position.
However, I'm unsure how this would work given a postback would occur when the cancel button was clicked. I'm using update panels, but this shouldn't make a difference to the solution.
If anyone can point me in the direction of a Microsoft sample page or offer advice, it would be appreciated.
For the moment, I'm stumped.

Need suggestions on best approach to update text entered into multiple textboxes without causing a postback that shifts the page

This is a concept question. I have a web form with 6 gridviews, below each gridview is a textbox. Each row of the gridview contains a question and 5 radio buttons. When a radio button is ticked or text is entered in the textbox it updates the database immediately with one caveat, the textbox is committed when the user presses the tab key, or refocuses curser outside the textbox, or clicks an unrelated button (basically when a postback or textchanged() event occurs).
The problem: There is a delay during postback when the text is committed to the database causing the user to think they can move to the next textbox only to have the curser return to the previous textbox. I added code to prevent the curser jumping but the delay is still an annoyance to users during testing. I added a confirmation message (label) to alert the user when it's ok to move on but when the confirmation message disappears at the next postback, usually when the user ticks the next radio button, the gridview shifts up and the user's curser is pointed to a different line of the grid. This is also annoying users.
Solutions? In my limited experience I have 2 alternatives maybe 3 (below). The reason I did not do either was because I wanted data to update the database as soon as it was typed or ticked. Since the radio buttons cause an immediate update I didn't want the users to inadvertently think the textboxes did too and forget to click a button to commit the text. Since entering text in the textboxes is optional, I don't have a way to validate if the user is done completing the form and remind them to click a button to commit their text input.
Put a button by each textbox to commit the text
Use one button to commit all textbox data when form is complete
Find a way to put a placeholder where the confirmation label is when its hidden so it doesn't shift on postback.
I'm starting to think one Submit button is the way to go and let the user think that is what saves the data? Simple.
At any rate is there a better way to achieve my goals of having input updated in database immediately without annoying delays (postbacks) and grid shifting at inopportune times?
In my case I changed the textbox AutoPostBack property to False and removed all code in the text_changed() event for all textboxes. I am committing the text when a Submit button is clicked. (The radio buttons still commit to db immediately when selected). In the end, I think users are conditioned to click a submit or save button when they finish filling out a form anyway.

MVC auto complete inputs according to recent user entries

I have a site that manages a database.
Lets say the users enter information about people (height, weight, name etc...)
A lot of people are entered each day and the height range is quite small so if a user entered a person with a certain height I want it to auto complete next time he enters a person.
(like most login forms where you click a textbox and it shows your recent entered login info and when you start typing it auto completes you).
I am using MVC 4 and the person entry is not within a form. When a user clicks save it uses ajax to save.
I know it works with forms but how can I do it on certain textboxes which arent in a form.
The jQuery autocomplete solution doesn't require fields to be in a form.
If you look at the source code of the sample, the previous data is stored as a JavaScript array. You could store previous entries for each user in a database and then use this data to build an JSON array that can be passed via a view-model to the view and then use jQuery.parseJSON() to render it straight into place in the JavaScript.

Add textbox to telerik radgrid confirmation dialog

I need to collect additional information from the user when they initiate a delete on a radgrid. Right now I am presenting the user with a confirmation dialog box that lets them click "OK" to continue but I need to add an additional textbox to collect a reason.
How do I do that?
See the documentation here: http://www.telerik.com/help/aspnet-ajax/grdconfirmationdialogs.html
Looks like you'll need to do a custom confirm dialog (possibly with a jQueryUI modal?) to add that form field in there.
Additionally, check this documentation: http://www.telerik.com/help/aspnet-ajax/grdaddingdeleteprompt.html
Specifically look at the heading "Display confirmation dialog with text including column cell value." They are talking about having the confirm show a value from the RadGrid, but you could modify that technique to do your custom confirm box.

Check pending changes before doing a another task on a ASP.NET Ajax page

I'm developing an ASP.NET web application with AJAX.
I have a page where the user can edit some information: it has a list of item, the user select one item, click on Edit button and then edit item's name and item's description on two textboxes.
If user click on another item since he doesn't save his changes, he can click on edit button to edit this new item.
I want to check if there is some data on textboxes and ask to the user if he wants to lose their changes before loading the data of the new item.
How can I do that?
Thank you.
There are four ways that I can think of to handle this:
Always save the changes (auto save). We've eliminated almost all save buttons from forms and just always auto save the data based on user feedback.
Always prompt to save changes; i.e. assume that if the form is in edit mode then there are changes.
Hook every control's change event and toggle a boolean if any control fires its change event; prompt the user if it's true.
The hardest (and arguably best) method is to actually compare the previous values to the current values and only prompt if they're different.
The method you select depends on the application and user expectations.

Categories

Resources