WebApplication,在DetailView的Tab中,当跳转页签时即刻保存提交内容的解决方法如下:
原文:http://www.devexpress.com/Support/Center/p/Q157281.aspx
重写ASPxPageControl的ActiveTabChanged事件,ObjectSpace进行提交即可,代码类似下面:
[C#] Open in popup windowpublic class CommitOnTabChangeViewController : ViewController { public CommitOnTabChangeViewController() { this.TargetViewType = ViewType.DetailView; } protected override void OnActivated() { base.OnActivated(); ((WebLayoutManager)((DetailView)View).LayoutManager).ItemCreated += new EventHandler<ItemCreatedEventArgs>(ViewController1_ItemCreated); } protected override void OnDeactivating() { ((WebLayoutManager)((DetailView)View).LayoutManager).ItemCreated -= new EventHandler<ItemCreatedEventArgs>(ViewController1_ItemCreated); base.OnDeactivating(); } void ViewController1_ItemCreated(object sender, ItemCreatedEventArgs e) { TabbedGroupTemplateContainer tabbedGroup = e.TemplateContainer as TabbedGroupTemplateContainer; if (tabbedGroup != null) { ASPxPageControlEx tabControl = tabbedGroup.Controls[0] as ASPxPageControlEx; if (tabControl != null) { tabControl.ActiveTabChanged += new DevExpress.Web.ASPxTabControl.TabControlEventHandler(tabControl_ActiveTabChanged); } } } void tabControl_ActiveTabChanged(object source, DevExpress.Web.ASPxTabControl.TabControlEventArgs e) { try { this.ObjectSpace.CommitChanges(); } catch { } } }