
Desember 8, 2014 07:43 by
Dan
Today, we will explain about Navigating to Another Page from DotNetNuke Custom Module. In a few circumstances, there is a prerequisite to add usefulness that permits clients to explore from one page then onto the next in Dotnetnuke Custom Module. For instance, in the event that you have a custom module called "Register" and the client has successfully registered, you may need to explore the client to an alternate page to view client login detail where an alternate custom module as of now been included request to view login client detail.

In Dotnetnuke module we require the Tab Id of the page so as to explore to an alternate page.So to attain this we can include a dropdown field in Edit page of our custom module(register) to demonstrate all the accessible Tab/ Page names of DNN site where client can choose the Page name to redirect which inside keeps the Tab Id as quality. Then, we can utilize that Tab Id value as a part of request to explore to other page.
[Code in C#]
EditRegister.ascx
//Adding a Dropdown field in EditRegister.ascx page to allow admin or host to select the redirect page name
<asp:DropDownList ID="ddlTabNames" runat="server"></asp:DropDownList>
EditRegister.ascx.cs
//Adding available page names to the dropdown using object of TabController
if (Page.IsPostBack == false)
{
DotNetNuke.Entities.Tabs.TabController objTabController = new DotNetNuke.Entities.Tabs.TabController();
ArrayList arrlTabs = null;
arrlTabs = objTabController.GetTabs(this.PortalId);
string strKey = string.Empty;
string strValue = string.Empty;
ddlTabNames.Items.Clear();
//Get the tabname and tabid of each tabs or page using object of TabInfo and added to dropdownlist field
foreach (Entities.Tabs.TabInfo objTab in arrlTabs)
{
strKey = objTab.TabName;
strValue = objTab.TabID.ToString();
ddlTabNames.Items.Add(new ListItem(strKey, strValue));
}
}
//Using ModuleControler object we need to save selected Page TabId in module specific variable
ModuleController objController = new ModuleController();
objController.UpdateModuleSetting(this.ModuleId, "TabID", ddlTabNames.SelectedValue);
ViewRegister.ascx.cs
Now From custom module view page we can redirect to another Page or Tab of DNN website using following code
//Get the selected TabId
int iProfileTabId = Convert.ToInt32(Settings["TabID"]);
//Redirect to selected Page
this.Response.Redirect(Globals.NavigateURL(iProfileTabId), true);