I put this module in 2 differrent page. The first page is the child of Home page. The second page has no parent. The module in the second page runs fine while module in the first page can not run.
I have debugged and found that it doesn't fire the buttons' click events in module in the first page. I don't know why. Here is the code:
protected void Button1_Click(object sender, EventArgs e)
{
DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(59));
}
protected void Button2_Click(object sender, EventArgs e)
{
DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "controlCS", "mid="+ModuleId));
}
protected void Button3_Click(object sender, EventArgs e)
{
DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(59, "controlCS", "mid=394" ));
}
protected void Button4_Click(object sender, EventArgs e)
{
DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(59,"", "giatri=2"));
}
protected void Button5_Click(object sender, EventArgs e)
{
DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(59, "controlCS", "mid=394&giatri=2"));
}
<%@ Control language="C#" Inherits="YourCompany.Modules.MyModuleCS.ViewMyModuleCS" CodeFile="ViewMyModuleCS.ascx.cs" AutoEventWireup="true"%>
<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
<asp:datalist id="lstContent" datakeyfield="ItemID" runat="server" cellpadding="4" OnItemDataBound="lstContent_ItemDataBound">
<itemtemplate>
<table cellpadding="4" width="100%">
<tr>
<td valign="top" width="100%" align="left">
<asp:HyperLink ID="HyperLink1" NavigateUrl='<%# EditUrl("ItemID",((int)DataBinder.Eval(Container.DataItem,"ItemID")).ToString()) %>' Visible="<%# IsEditable %>" runat="server"><asp:Image ID="Image1" Runat=server ImageUrl="~/images/edit.gif" AlternateText="Edit" Visible="<%# IsEditable%>" resourcekey="Edit"/></asp:hyperlink>
<asp:Label ID="lblContent" runat="server" CssClass="Normal"/>
</td>
</tr>
</table>
</itemtemplate>
</asp:datalist>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button1" />
<asp:Button ID="Button2" runat="server" Text="Button2" Width="79px" OnClick="Button2_Click" />
<asp:Button ID="Button3" runat="server" Text="Button3" OnClick="Button3_Click" />
<asp:Button ID="Button4" runat="server" Text="Button4" OnClick="Button4_Click" />
<asp:Button ID="Button5" runat="server" Text="Button5" OnClick="Button5_Click" />
<asp:Button ID="Button6" runat="server" Text="Button6" OnClick="Button6_Click" />
<asp:Button ID="Button7" runat="server" Text="Button7" OnClick="Button7_Click" /><br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>