Writing JavaScript from a Custom Control
<p>I'm new to writing custom controls.  I have MyCustomControl.cs and in my Render method I want to render out about 50 lines of JavaScript.  What's the best way to do this, use the writer?</p>

<pre><code>protected override void Render(HtmlTextWriter writer)
        {
            writer.write(@"&lt;script type....rest of opening tag here");

            writer.Write(@"
                            function decode(s)
                            {
                                return s.replace(/&amp;amp;/g, ""&amp;"")
                                .replace(/&amp;quot;/g, '""')
                                .replace(/&amp;#039;/g, ""'"")
                                .replace(/&amp;lt;/g, ""&lt;"")
                                .replace(/&amp;gt;/g, ""&gt;"");
                            };"
            );
</code></pre>

<p>I plan on having around 6 more writer.Write to write out some more sections here.  Is that the best approach to actually perform the writing of JavaScript in this manor?</p>

<p>or should I use ClientScript.RegisterClientScriptBlock?  So what's the best practice or common way people are writing javascript from a custom control? (I'm not talking about a user control here!!, custom control/Class!)</p>

<p>I also want to keep any indentation for readability once it's spit out/rendered on the client when viewing source.</p>
