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.
Related
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.
Once I successfully validate user data in a TextBox (using TextChanged EventHandler), I'd like to programmatically tab to the next input control. I know I could hard code the name and do
Score2.Focus(Windows.UI.Xaml.FocusState.Keyboard);
but I've got 20 TextBox controls on the page page and I'd like to use the same EventHandler for all of them.
While it may be possible (iterate through the page's control inspecting their tab order and selecting the appopriate next control), I would recommend against it. It will irritate your user if they leave a text box to go back and correct a previous field but your app decides it knows better and gives focus to another field.
I have used check box in gridview . Now i want to validate those checkboxes as if no check box is selected a message shud pop up saying please select check box and thn press submit
Thanks
Smartdev
You can use a CustomValidator which validates if the user checked the Checkbox. You must set ValidateEmptyText to true. Following an example which you can rewrite easily to validate a Checkbox: CustomValidator in a GridView with a ValidationSummary control
There is a tutorial here that will walk you through how to perform validation using Javascript on the client side.
You can easily modify the logic with in the javascript to throw up an alert if no boxes are checked.
IMO client side validation would be better as it will save a trip to the server.
In addition, you could implement the AJAX Mutually Exclusive CheckBox in the GridView item template to force users to check a maximum of one box. However, from your question I'm not 100% sure if you require this.
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.
I have two tabitems. User will enter some data and save it on the first tab. The second tab lists the saved data. What I need is when the user select the second tab before saving data in first tab a confirmation message box with Yes, No and Cancel should be shown. If the user clicks Yes button the data should be saved and go to the second tab. If he hits No, the data need not to be saved and finally if Cancel is hit the tab will retain with all entered data. How can i make this?
To keep things simple you can do the follwing in the Code Behind file.
I'd create a Model class of the data you want to display and edit in the WPF Control. Make the Model implement the INotifyPropertyChanged and IEditableObject interfaces.
INotifyPropertyChanged will allow you to Bind to the Model.
IEditableObject will allow you to provide Edit, Save and Cancel functionality.
The TabControl has a SelectionChanged Event you can handle, that will allow you to detect when the user changes tabs, in this handler you can use System.Windows.MessageBox to ask the user to save etc, System.Windows.MessageBox.Show() returns a MessageBoxResult Object you can use to detirmine what button the user clicked and perform the appropiate action.
This is not a geat way to do things, but it keeps things simple, you may want to look into some WPF design Patterns to help with Code Manageability.
If you need anything explained further, just ask.
Although I disagree with the way you interrupt the user's flow from tab to tab I'm going to humor you and answer the question:
You'll need two things to get this done:
The event that occurs when a tab was clicked
The previous tab that was selected (the one you came from)
The first item:
The tab control has a Click method that you can subscribe to:
Click=”MyTabButton_Click”
The second item:
This part you'll have to do manually. You can set a variable in the click event which contains what tab was last selected. Once this is set you can check a variable (which you previously set) as to what tab was previously selected. You can then do all your validation.
Delphi's TPageControl has an OnChanging event with an "AllowChange" parameter. I guess there is something similar in WPF.