Adding javascript functions to asp control
<p>iv'e got an asp button which performs another task besides postback </p>

<p>i have done this by adding javascript code to the button as follows </p>

<pre><code>       if( !IsPostBack )
            btn1.Attributes.Add("onclick", "f();");
</code></pre>

<p>i'm not sure of 2 things </p>

<p>the first :</p>

<p>where in the cs code i should add the function f() , currently i'm doing it in page load 
while ignoring postbacks because then the function would have already been added(i might be wrong)</p>

<p>the second :</p>

<p>is there any to make the function execute only if the page was validated ? (after postback)</p>

<p>thanks in advance
eran.</p>
