views:

113

answers:

1

I am trying to create an ASP.net server control for displaying formatted code, using this library: http://www.manoli.net/csharpformat/

Here's the trick: I want be able to express code blocks like this...

<custom:CodeFormatter runat="server">
<asp:Label runat="server" ID="something" Text="my text" />
<asp:Image runat="server" ID="something" ImageUrl="header.jpg" />
</custom:CodeFormatter>

...but not have the inner tags actually execute. I want the Label & Image to be seen by CodeFormatter as raw text, not parsed as real server tags.

So my question is, how to prevent the Label from actually rendering as such? And how to access everything within the custom:CodeFormatter as raw, literal text?

My workaround right now is to encode the <>'s as &lt; and &gt;. I'd love not to do that.

Thanks!

+1  A: 

How about extending your control to use ITemplate. Here is a article that explains how to extend a control.

http://www.devx.com/codemag/Article/32182

Jim Scott
Would the controls be rendered in the template field instead of staying literal?
orip