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

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 )

Google+ photo

You are commenting using your Google+ 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