You can use znn module for this as third party.
If you want to make something yourself. Use this code. It is more or less a copy of the vb framework of dnn, but then in c#. due to versioning I did not remove the commented lines.
Make sure you use: slaveModule.EndDate = DateTime.MaxValue; //work around. It has taken us quite a few days to find out that this was actually turning our module invisible :-(
ENJOY!
J.
/// <summary>
/// Init (load/create and add) dynamic controls.
/// </summary>
protected virtual void InitDynamicControls()
{
Skin skin = Skin.GetParentSkin(this);
ModuleController moduleController = new ModuleController();
ModuleInfo objModule = null;
if(BasicStoreInfo.StorePortalRegionInfo.DisclaimerModuleId.HasValue)
objModule = moduleController.GetModule(BasicStoreInfo.StorePortalRegionInfo.DisclaimerModuleId.Value, BasicStoreInfo.StorePortalRegionInfo.DisclaimerTabId, false);
if (objModule != null)
{
ModuleInfo slaveModule = objModule.Clone();
if (slaveModule != null) //BAPY-3095
{
if (slaveModule.InheritViewPermissions)
slaveModule.AuthorizedViewRoles = PortalSettings.ActiveTab.AuthorizedRoles;
slaveModule.Header = "";
slaveModule.Footer = "";
slaveModule.StartDate = DateTime.MinValue;
slaveModule.EndDate = DateTime.MaxValue; //work around.
slaveModule.PaneName = DotNetNuke.Common.Globals.glbDefaultPane;
slaveModule.Visibility = VisibilityState.None;
slaveModule.Color = "";
//If Request.QueryString("dnnprintmode") <> "true" Then
// slaveModule.Alignment = "center"
//End If
slaveModule.Border = "";
slaveModule.DefaultCacheTime = -1;
slaveModule.DisplayTitle = false;
slaveModule.DisplayPrint = false;
slaveModule.DisplaySyndicate = false;
//FROM DNN 4.5.5 source.
// If Not objModule Is Nothing Then
// 'Clone the Master Module as we do not want to modify the cached module
// slaveModule = objModule.Clone()
// If slaveModule.InheritViewPermissions Then
// slaveModule.AuthorizedViewRoles = PortalSettings.ActiveTab.AuthorizedRoles
// End If
//End If
//For SKIN-4252
//Commented out by Beasyer on 2008-03-18
//objModule.EndDate = DateTime.Now.AddDays(1); jo: 20080320 --> set to avoid that if <> host or <> admin
//a red box is shown that only visible to admin--> but probably site effect!
//slaveModule.Visibility = VisibilityState.None;
//slaveModule.DisplayTitle = false;
//slaveModule.DisplaySyndicate = false;
slaveModule.ContainerSrc = SkinController.formatSkinSrc("[G]" + SkinInfo.RootContainer + "/_default/No Container.ascx", PortalSettings);
//if ((slaveModule.StartDate >= DateTime.Now || slaveModule.EndDate <= DateTime.Now) ||
// (slaveModule.AuthorizedViewRoles.ToLower = ";" & PortalSettings.AdministratorRoleName.ToLower & ";"))
//{
// //WILL SHOW MESSAGE!
// Console.WriteLine("show message");
//}
if (PortalSecurity.HasNecessaryPermission(slaveModule.ControlType, PortalSettings, slaveModule))
{
//try to inject the module into the skin
try
{
Control myControl = new Control();
skin.InjectModule(myControl, slaveModule, PortalSettings);
//StringWriter strWrt = new System.IO.StringWriter();
//myControl.RenderControl(new HtmlTextWriter(strWrt));
//DotNetNuke.UI.Utilities.DataCache.SetCache(cacheString, strWrt.ToString(), DateTime.Now.AddHours(Convert.ToInt32(_settings.CategoryMenu.CacheTime)));
//TextBox txtBox = new TextBox();
//txtBox.TextMode = TextBoxMode.MultiLine;
//txtBox.ReadOnly = true;
//txtBox.Enablev13wstat3 = false;
//txtBox.Text = strWrt.ToString();
//plhDlvryCd.Controls.Add(txtBox);
plhDlvryCd.Controls.Add(myControl);
}
catch (Exception e1)
{
Exceptions.ProcessModuleLoadException(ContainingDNNModule2.Parent, e1);
}
}
}
}
}