I have a page with two UpdatePanels with UpdateMode=Conditional. The first contains a treeview. The second, a DetailsView. The TreeView is used to select the record to edit in the UpdatePanel by dropping the product into the session the getting the panel to update. All works nicely.
protected void Select_Change(Object sender, EventArgs e)
{
if (ProductView.SelectedNode.Depth == 2)
{
int nodeToEdit = Convert.ToInt32( ProductView.SelectedNode.Value);
Session["productid"] = nodeToEdit;
DetailsView1.ChangeMode(DetailsViewMode.Edit);
DetailPanel.Update();
}
}
What I want to do is cancel the navigation or warn the user or just about anything helpful really if the detailsview is "dirty" i.e. the user has typed something into any of the detailsview fields and not saved the form.
(Its quite a simple form - just 3 text boxes, a dropdownlist and a checkbox, so, athough I'd prefer not to, I could manually compare old and new if I had a handle on them, although that is nasty.)