Modify a DNN Module without touching the ASCX

What do you do when you get a module for dotnetnuke, either one that comes with it, or one that you obtain from a third party, and you want to change the presentation layer?

I would imagine that many people would just open up the ascx file, make the change, and be done with it. But, if you do that, what happens when you install an upgrade to that module?

Of course, you’ll have to make the change all over again. And we all know that when you upgrade, you’ll forget about the modification for a few weeks. But, what if there were some way of making those changes without having to touch the original ascx files?

There are two ways you might do this. One would be to create and install a filter on the server side that rearranges the html on the way back to the server. This is probably the best method as it is not dependant on server side technology. However, it may take a bit more tweaking to get it right and is only available to .NET programmers.

The second method, and one I’ve used with great success, is to use a Text/HTML module and insert javascript that reads the DOM and rewrites the HTML. I have come to call this “JavaScript Re-Writes”

I’ve used this to:

  • Remove text from a module that I don’t want to have displayed.
  • Insert text into a module that was missing
  • Hide links I want the spiders to see, but I don’t want the end user to see (note: there are times when this is appropriate and times when it is an SEO trick that is sure to backfire. Know the difference before you implement it.)
  • Insert tooltips over elements that should have them but don’t.
  • Change link buttons that use text to graphic buttons.

The beauty is, when I upgrade, 99% of the time, the DOM doesn’t change and my changes are still in effect. Further, anyone who knows JavaScript can make the change and they don’t have to be a .NET programmer to do it.

Most Commented Post

Comments are closed.