Created
February 22, 2012 14:22
-
-
Save bbarry/1885328 to your computer and use it in GitHub Desktop.
Dnn Additional Tab Settings module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class PageSettings : System.Web.UI.UserControl { | |
protected override void OnPreRender(EventArgs e) { | |
base.OnPreRender(e); | |
if (Page.IsPostBack && PageUtil.IsPageValidated() && Page.IsValid && | |
Page.Request.Params.Get(Page.postEventSourceID).Contains("cmdUpdate")) { | |
//cmdUpdate_click postback event occurred | |
var Tabs = new TabsController(); | |
Tabs.UpdateTabSetting(TabId, "MyNewSetting", MySetting.Text); | |
} | |
} | |
public int TabId { | |
get { | |
return PortalSettings.Current.ActiveTab.TabID; | |
} | |
} | |
} | |
public class PageUtil { | |
public static bool IsPageValidated() { | |
var page = HttpContext.Current.Handler as Page; | |
if (page == null) | |
return false; | |
FieldInfo fieldValidated = typeof(Page).GetField("_validated", BindingFlags.Instance | BindingFlags.NonPublic); | |
if (fieldValidated != null) return (bool)fieldValidated.GetValue(page); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment