Mr. Bean Posted February 2, 2009 Share Posted February 2, 2009 Anybody know a way of displaying the aspx code(<% %>) without manually performing an HtmlEncode? I want to display a block of aspx code within my aspx page. Example.aspx: <p>Check out this cool code:</p> <pre> <% int x = 0; %> </pre> Link to comment Share on other sites More sharing options...
0 ZakO Posted February 2, 2009 Share Posted February 2, 2009 Not sure if this will be much help but you should be encoding the characters anyway otherwise it won't validate, if you don't want to call the function just use <p>Check out this cool code:</p> <pre> <% int x = 0; %> </pre> Link to comment Share on other sites More sharing options...
0 +primortal Subscriber² Posted February 2, 2009 Subscriber² Share Posted February 2, 2009 just do %lt; and %gt; in your html Link to comment Share on other sites More sharing options...
0 Mr. Bean Posted February 2, 2009 Author Share Posted February 2, 2009 I know I can explicitly do the encoding myself, but was wondering if there was a way to wrap it in some way in which I wouldn't have to do it (would make large code blocks tedious). Doesn't appear to be possible though -- thanks. Link to comment Share on other sites More sharing options...
0 Antaris Veteran Posted February 2, 2009 Veteran Share Posted February 2, 2009 You could probably create an ASP.NET control using an ITemplate which outputs its content as encoding text? Link to comment Share on other sites More sharing options...
Question
Mr. Bean
Anybody know a way of displaying the aspx code(<% %>) without manually performing an HtmlEncode?
I want to display a block of aspx code within my aspx page.
Example.aspx:
Link to comment
Share on other sites
4 answers to this question
Recommended Posts