In my form, I have 2 different ways of saving:
"Save" stores the user's input into the list through a postback, and allows further data entry after a jQueryUI popup dialog to confirm successful save.
"SaveClose" stores the user's input into the list through a postback, and then executes a contextual backout to return to the list page.
My problem lies in that if the user does a "Save" and then a "SaveClose", each save will create a new list item, resulting in the creation of 2 items.
In the code, it is obvious that this will occur:
public void SaveClose_Click(object sender, EventArgs e)
{
_ControlBinder.SaveToList(CurrentMode.Equals(FormMode.New), delegate(...) { ...}); Backout();
}
public void Save_Click(object sender, EventArgs e)
{
_ControlBinder.SaveToList(CurrentMode.Equals(FormMode.New), delegate(...) { ... });
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "$(\"#savedDialog\").dialog(open);", true);
}
When simply clicking "Save", the form is saved to the list, but the FormMode does not change. I have found the ChangeMode functionality, but have had no luck getting it to work.
Is there a way to change the mode of a form through C# codebehind? (Or a better conditional I could use besides CurrentMode.Equals(FormMode.New))