View data save -without any button click - maximo-anywhere

I have a view which has some data entered by user. Once user moves out of this View, data in it should get automatically saved. We don't have any save button to get any click event. Please advise, how to capture View event once we dont have any save button
Thanks

There's a saveonshow attribute that you can set to true to automatically save when you leave that view and return to the previous view.

Related

detect changes in the System.Windows.Forms.TabPage

I have a System.Windows.Forms.TabControl with collection of System.Windows.Forms.TabPage. Each TabPage is a form where users can enter text values. When a user changes tab, If there are any changes in the current tab; I need to prompt them if they want to save changes made in the current tab. How do I detect if there was a change in the state of current TabPage?
Attach an event handler to each control on the tab page, which sets a flag to indicate that data on the tab page has been changed ("is dirty").
Subsequently, attach an event handler to the Selecting event of your TabControl to show a prompt when you detect that the dirty flag has been set to true for the tab page that is about to be navigated away from.

Insert/Update on single button

I have modalpopup with textboxes in it.
Before the user gets to the modal popup, he either clicks ADD or EDIT.
If he clicks ADD, all the textboxes are empty and he gets to add a new address.
If he clicks EDIT, the textboxes already contain his address and he gets to edit his address. Now I have a single SAVE button on which I have to decide whether the data in the textboxes needs to be INSERTED (ADDED) or UPDATED (EDITED). How do I achieve this? I mean how do I find out if the user has clicked on ADD or EDIT??
keep the action in the viestate and check what value it is.
If user click edit then on editclick
ViewStat["Action"]="Edit";
On save button check for the view state value
if(ViewStat["Action"]!=null)
{
if(ViewStat["Action"].ToString()=="Edit")
{
//update statement
}
else
{
//insert statement
}
}
Also you can also set it to empty or null on cancel click
ViewState["Action"]=null;
Take an hidden field in your page. On add button click set its value to "0" and on edit button click set value to the id of the record that has to be updated. You can check value of your hidden field on server side to decide what to do.

Browser back button does not move to the previous View

I am using views concept in my asp.net form control.my first view consist of a form to capture user details.when user press continue it will move to the second view.
The problem is ,When user press the back button of the browser from the second view it doesn't move the the previous view instead move to the previous page in the browser history.
I wanted to move to the first view with the existing data in the form,when user press the back button of the browser.
You should perform a full page postback I guess, so that at client end your previous view will be saved in browser's history.

User Control not working

http://binaryjack.com/userControl.aspx
Each record is displayed using a user control. I have the delete button embedded in the user control.
Recreate Problem: click the first DELETE button, the last row gets deleted; after this I have to click the delete button (any of them) twice to make it work.
Is it bad practice to use a User Control (combined with a placeholder) to display a bunch of records? I query to get all records and then use a Foreach loop to populate each User Control and insert each UC into the placeholder.
Why does the Delete button not respond correctly?
Without seeing your code it is tough to say. However, it appears to be a refresh issue. If you hit delete then hit refresh, the record is gone. Check how you are refreshing the data and you'll find the issue.

Cancel button that does not send form data

Inside an UpdatePanel I have two PlaceHolders which are never visible at the same time. In one PlaceHolder I let the user choose an article to edit and when an article is selected it is displayed in the other PlaceHolder. When this happens is set the visibility of the first one to false and turn the other one on.
Now, when the user edits the article there are some fields and two buttons: one button is labeled "OK" and is used to send the form data to the server and the other button is labeled "Cancel" and is used to. It is only when the user clicks the OK-button that I need to send the form data to the server since this is the only situation where bother to handle it. Therefore, can I let the system know that the it should not send form data when the Cancel-button is clicked?
The issue was brought up because at first, I got a RequestValidation-error from the tinyMCE-component that is used for the body of the article (since it contains HTML), when I clicked the Cancel-button. Now I have turned off RequestValidation for this page and I do the validation manually.
But anyway, can I turn off form-data-sending when the Cancel-button is clicked?
Maybe if you prevent the postback when clicking the Cancel button you'll disable the form-data sending. This could be achieved by subscribing to the OnClientClick event of the button and type return false as a value.

Resources