// you’re reading...

Best practice

How to integrate ASP.NET into RedDot CMS projects – Best practice on .NET template embedding


1. Reference the .ascx file at the very top of the template

<reddot:cms><if><query valuea="Context:CurrentRenderMode" operator="==" valueb="Int:2"><htmltext>
<%@ page language="C#" %>
<%@ Register Src="~/UserControls/Search.ascx" TagName="Search" TagPrefix="uc" %>
</htmltext></query></if></reddot:cms>

This example references a code behind file for a search used on the web server. It is placed in the top of every page instance created with this template. This way you only have to integrate the .NET reference once in each template. You can break it down to once per project if you use a container approach.

2. Place the User control tags as placeholder for the .NET functionality

<body>
  <div id="site">
    <div id="header">
<reddot:cms><if><query valuea="Context:CurrentRenderMode" operator="==" valueb="Int:2"><htmltext>
      <uc:Search ID="Search" runat="server"/>
</htmltext></query></if></reddot:cms>

This is the ASP.NET User Control for your search interface. Since you don’t run the search inside of your CMS project we have used a Render Tag to exclude this block from showing up within the CMS. If you want to be fancy you can put some placeholder content here by using a different Context:CurrentRenderMode block where you use valuea=”Context:CurrentRenderMode” operator=”<>” valueb=”Int:2″ to show HTML code only on the CMS server, you can read more about this here.

What do you get out of it? And How to change User Control values…
Read more »

Share and Enjoy:
  • Print
  • email
  • Twitter
  • Digg
  • Reddit
  • StumbleUpon
  • Google Bookmarks
  • del.icio.us
  • MisterWong
  • Facebook
  • LinkedIn
Related posts:
  1. RedDot & 301 Redirects: How to manage 301’s within your RedDot CMS projects
  2. An undocumented RenderTag to enhance your RedDot CMS usability
  3. Two RedDot API RenderTags for OpenText CMS developers
  4. RedDot CMS API – or – RQL in a nutshell – Part 2
  5. Workaround – Placing red dots inside of OpenText CMS Render Tags

Pages:

1 2 3

About the author:

Markus Giesen Markus Giesen is a Solutions Architect and RedDot CMS Consultant, formerly based in Germany. Travelling around the world to find and offer solutions for a better world (in a very web based meaning). He just found a way to do this as part of a Melbourne based online consultant house. On this blog Markus shares his personal (not his employers) thoughts and opinions on CMS and web development. In his spare time you will find him reading, snowboarding or travelling. Also, you should follow him on Twitter!

Discussion

3 comments for “How to integrate ASP.NET into RedDot CMS projects – Best practice on .NET template embedding”

  1. We avoid putting “@ Register” tags into every template by registering tag prefixes globally in the web.config file. That way you can create a MySuchAndSuchUserControl content class and the content authors can plonk them wherever they like.

    Posted by Richard Hauer | March 10, 2010, 2:06 am
  2. You can also create a “CS” variant for code-behind files which use FileRead render tags to pull their content in from a regular .net project. Combine with VSS and a build machine to ensure your CMS always has up to date code and you can use CMS elements in your C#!

    Posted by Richard Hauer | March 10, 2010, 3:18 am
  3. User Controls are exactly the way we figured out to integrate ASP.NET into our RedDot projects as well!

    Two more hints:
    1. The page directive is unnecessary if you make C# the default instead of VB in the IIS ASP.NET configuration. Like this you avoid the limitation of only one page directive per ASPX file.

    2. If your UC requires content/translation from within RedDot you could define public properties in your UC with getters and setters. You may then pass the content place holder to the UC like this:
    <uc:Search ID=”Search” runat=”server” SubmitButtonCaption=”<%stf_submit_button_caption%>” />

    Posted by Andreas B. | March 24, 2010, 6:02 pm

Post a comment



Stay up to date! - Get notified about followup comments

If you don't feel the urge to comment but wish to stay in the loop:
Just enter your email and subscribe to new comments.

Subscribe without commenting

Recent Tweets

  • RT @AirKraft: Transport Canada breakout: they manage 80K pages and 300K assets with WSM(RedDot). Wow! #OTCW 2010-11-11
  • The RedDot usergroup session 'Future of WCM' is in National Harbor 7, now. See you there! #otcw 2010-11-11
  • RT @yttergren: @AirKraft: Calling all WSM(RedDot) devs: share your solutions on http://bit.ly/bgPIof EVERY solution can win an iPad #OTCW 2010-11-10
  • Come to the Solution Exchange session. Enhance your (#reddot) CMS project! Chesapeake 12, 3:20pm #otcw Looking forward to see you there! 2010-11-10
  • More updates...