Proper way to escape characters from RegisterStartupScript
<pre><code>ScriptManager.RegisterStartupScript(page, 
    page.GetType(),
    "KEY",
    "updateDockTitle('" + ClientID + "', '" + string.Format(format, ChartName, "No Data To Display") + "');".Replace("-", "\\-"),
    true);
</code></pre>

<p><code>ChartName</code> has the ability to contain special characters (e.g. Someone's Chart). If allowed as is this causes an error the code hits the <code>'</code> when it was not expecting it.</p>

<p>What's the proper way to handle this scenario? Do I need to know all characters that could cause issues and replace them with escaped out versions?</p>
