CodeSmith Community
Your Code. Your Way. Faster!

How to prevent rendering to a file?

Latest post 04-08-2007 11:28 PM by Entropy. 2 replies.
  • 04-08-2007 1:11 AM

    • Entropy
    • Not Ranked
    • Joined on 04-08-2007
    • Posts 5
    • Points 85

    How to prevent rendering to a file?

    Hi.
    I try to use reflection for generating, so sometimes I need to start executing of my template but not to render anythig. Now if I do not write to output I get empty files. So how can I prevent rendering of empty files without throwing an exception?
    Thanks.
    Filed under:
    • Post Points: 35
  • 04-08-2007 11:04 PM In reply to

    • pwelter34
    • Top 25 Contributor
    • Joined on 03-13-2003
    • Eden Prairie, MN
    • Posts 255
    • Points 749,915

    Re: How to prevent rendering to a file?

    Hi,

    There is an easy way to do this.  The CodeTemplate declaration has an attribute called OutputType.  Set the OutputType=None and that will do what you want.

     <%@ CodeTemplate ... OutputType="None" %> 

    ~ Paul 

    • Post Points: 35
  • 04-08-2007 11:28 PM In reply to

    • Entropy
    • Not Ranked
    • Joined on 04-08-2007
    • Posts 5
    • Points 85

    Re: How to prevent rendering to a file?

    Yes
    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems