Im creating the passage of a site through a module that will dynamically load various controls onto different pages. For some reason, events on the subcontrollers do not fire.
Main view
<%@ Control language="C#" Inherits="DotNetNuke.Modules.SiteWalkthrough.View" AutoEventWireup="false" Codebehind="View.ascx.cs" %>
<%@ Register Src="/DesktopModules/SiteWalkthrough/Controls/Start.ascx" TagPrefix="sw" TagName="start" %>
<asp:MultiView ID="MultiView" runat="server">
<asp:View ID="mvStart" runat="server">
<sw:start ID="ucStart" runat="server"></sw:start>
</asp:View>
</asp:MultiView>
Code appearance
namespace DotNetNuke.Modules.SiteWalkthrough
{
public partial class View : SiteWalkthroughModuleBase, IActionable
{
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
private void Page_Load(object sender, System.EventArgs e)
{
MultiView.SetActiveView(mvStart);
}
}
}
User control
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Start.ascx.cs" Inherits="DotNetNuke.Modules.SiteWalkthrough.Controls.Start" %>
<div>
<span>Welcome!</span>
<span><asp:Button ID="btnNext" runat="server" Text="Okay" CssClass="btnNext" OnClick="btnNext_Click" /></span>
</div>
User management code
namespace DotNetNuke.Modules.SiteWalkthrough.Controls
{
public partial class Start : PortalModuleBase
{
protected void Page_Load(object sender, EventArgs e) {}
protected void btnNext_Click(object sender, EventArgs e)
{
}
}
}
This code works fine with a standard ASP.NET project, but not in DotNetNuke. Do I need to manually register events in OnInit on the main screen?
source
share