MyLifeBBS

The world with no boundaries

  • Home
  • Google Apps
  • DotNetNuke
  • Things in The Internet
  • SEO
  • Contact Me

Show DNN Module in Another Module’s Generated Page.

December 26, 2009 by George

One of the greatest feature of DotNetNuke is to allow use to show the module in the page they like based on the viewer’s role and permission. However, this only apply to DotNetNuke generated pages. So, how about showing a module only in a page that is generated by Blog Module for example?

The solution is simple, all you need to do is add the following lines into your skin.ascx file:

<% If Regex.IsMatch (Request.URL.ToString, "REGEX HERE") Then %>
<div id="ExtraPane" runat="server"></div>
<% End If %>

The idea is to show a module pane only when a specific page is called. In the above example, we use ASP.NET Regex to match with the requested URL with the self defined Regex value “REGEX HERE”.

Using Ventrian’s Article Module for example, the default URL of a Article Page looks something like this:

http://www.example.com/NewsArticles/tabid/218/articleType/ArticleView/articleId/384/Example-Page.aspx

In the url above, we can easily identify the unique parameter of the module’s generated url: ArticleView, we use this as the Regex filter and replace it with  “REGEX HERE” and you have this:

<% If Regex.IsMatch (Request.URL.ToString, "ArticleView") Then %>

If you worry you might have the word “ArticleView” word in other pages’ URL, you could put a longer regex value to filter it:  &tabid=218&ArticleView=

Important Note: The “Request.URL.ToString” calls the raw url which looks like this:

Default.aspx?TabId=88&ArticleView=

Thus, your Regex Value must match with the raw url and not the Human Friendly Url that you see in the web browser.

If you do not know the raw url of the module generated page’s url, you could add this into your skin file to find it out:

<!-- <%= Request.URL.ToString %> -->

Note: <!–   –> is added so that it will not show in the normal view but you can see it via browser’s view page source function. This is to avoid interference in production site.

For a live demonstration, you can see this page:

http://www.goeatout.com.my/Restaurants/Promotions.aspx and

http://www.goeatout.com.my/Restaurants/Promotions/Details/View/PID/31315/Hong-La-Qiao-Restaurant-Steamboat-Buffet.aspx

In the second link, a module “More Related Dining Promotions” is added at the page bottom which only shows in the page with “PID” in the URL but not in any of it’s parent page /Promotions/

For advanced combination, you could add “AND” in the code:

<% If Regex.IsMatch (Request.URL.ToString, "REGEX HERE") AND DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) Then %>
        <div id="ExtraPane" runat="server"></div>
<% End If %>

In the example above, it will show the extra pane only if the request url is match with your regex and the viewer has administrator role.

Have fun^^

Filed Under: DotNetNuke Tagged With: DotNetNuke, Request URL, Show Module only specific page

Recommended DNN Modules

SiteGround Hosting Fast and Reliable WordPress hosting that we recommend.
XMOD Pro is a very good module to create complicated forms with external database writing. You could use it to build a simple module as well. The drawbacks like custom permission and filtering might be an issue though.
Ultra Video Gallery is a very advanced multimedia module which allows you to create a site near to YouTube. It allows you to convert video directly in the website, share it, comment, membership integration and so on.
Project Management Templates, This is not a DNN module but if you need to manage your works better, try the project management templates. It helps a lot.

Post Archives

Blogroll

  • Food Promotions in Kuala Lumpur GoEatOut Promotion Page

Recommended Sites

  • DNN Store is the best place to shop for DNN modules
  • Malaysia Food Guide Best place to find malaysia food promotions and place to eat.
  • Malaysia Public Holidays A site that list out all public holidays in Malaysia with lunar calendar too

Recent Comments

  • kenny on How to modify DNN 6 login module skin design – Quick Guide
  • michelle on Turn back On Windows 8 Wifi – 100% works
  • Oracle9 on Turn back On Windows 8 Wifi – 100% works
  • AK on Turn back On Windows 8 Wifi – 100% works
  • Customizing the DotNetNuke login page : Karl’s Place on DotNetNuke Customizing your Login – PART 3

About the Author

I'm the founder of InnoChannel Sdn Bhd. We're here to help people to market their business online and also a Google Apps Premier Partner in Malaysia who provides email consultation, setup, data migration and so on.

Copyright © 2025 · News Pro Theme on Genesis Framework · WordPress · Log in