ASP.Net How do I execute a dynamic JavaScript and prevent a postback
<p>I have and ASP button and 2 Labels.</p>

<pre><code>&lt;asp:Button runat="server" ID="btnHide" /&gt;
&lt;asp:Label runat="server" ID="lblName"&gt;&lt;/asp:Label&gt;
&lt;asp:Label runat="server" ID="lblPosition"&gt;&lt;/asp:Label&gt;
</code></pre>

<p>I have created a dynamic JS script.</p>

<pre><code>string jsbtnHide = @"document.getElementByID('" + lblName.ClientID + @"').value = '';
document.getElementByID('" + lblPosition.ClientID + @"').style.display = 'none';";
</code></pre>

<p>I assign the script to the button. I've tried both "OnClick" and "OnClientClick".</p>

<pre><code>btnHide.Attributes.Add("OnClick", jsbtnHide);
</code></pre>

<p>However I cannot get the script to execute successfully and without a postback.
I've tried adding OnClientClick="return false;" both dynamically and to the ascx file. Dynamically seems to be ignored, though it appears correct in FireBug.
OnClick doesn't seem to prevent the Postback.
When the script does run, lblName doesn't change to '', haven't got this to work once.</p>

<p>What am I doing wrong?  I've been at this for days :(</p>
