DNN: Navigating Within a Module

Here are several methods which can be used to navigate between controls within a DotNetNuke module.

#region Navigation Methods
 
/// 
/// Redirects to module view.
/// 
protected virtual void RedirectToModuleView()
{
    Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), true);
}
 
/// 
/// Gets the module control URL.
/// 
/// Name of the control.
/// 
protected virtual string GetModuleControlUrl(Enum controlName)
{
    string[] param = new string[2];
    param[0] = MODULE_ID_KEY;
    param[1] = ModuleId.ToString();
 
    return DotNetNuke.Common.Globals.NavigateURL(TabId, controlName.ToString(), param);
}
 
/// 
/// Gets the module control URL.
/// 
/// Name of the control.
/// Name of the parameter.
/// The parameter value.
/// 
protected virtual string GetModuleControlUrl(Enum controlName, string parameterName, int parameterValue)
{
    return GetModuleControlUrl(controlName, parameterName, parameterValue.ToString());
}
 
/// 
/// Gets the module control URL.
/// 
/// Name of the control.
/// Name of the parameter.
/// The parameter value.
/// 
protected virtual string GetModuleControlUrl(Enum controlName, string parameterName, string parameterValue)
{
    string[] param = new string[4];
    param[0] = MODULE_ID_KEY;
    param[1] = ModuleId.ToString();
    param[2] = parameterName;
    param[3] = parameterValue;
 
    return DotNetNuke.Common.Globals.NavigateURL(TabId, controlName.ToString(), param);
}
 
/// 
/// Gets the module control URL.
/// 
/// Name of the control.
/// The parameters.
/// 
protected virtual string GetModuleControlUrl(Enum controlName, string[] parameters)
{
    List<string> param = new List<string>();
    param.Add(MODULE_ID_KEY);
    param.Add(ModuleId.ToString());
    param.AddRange(parameters);
 
    return DotNetNuke.Common.Globals.NavigateURL(TabId, controlName.ToString(), param.ToArray());
}
 
#endregion

Published by

Tim Clark

Experienced Business Owner, Chief Information Officer, Vice President, Chief Software Architect, Application Architect, Project Manager, Software Developer, Senior Web Developer, Graphic Designer & 3D Modeler, University Instructor, University Program Chair, Academic Director. Specialties: Ruby, Ruby on Rails, JavaScript, JQuery, AJAX, Node.js, React.js, Angular.js, MySQL, PostgreSQL, MongoDB, SQL Server, Responsive Design, HTML5, XHTML, CSS3, C#, ASP.net, Project Management, System Design/Architecture, Web Design, Web Development, Adobe CS6 (Photoshop, Illustrator)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s