passing a parameter to a JavaScript function
<pre><code>int i = Convert.ToInt32(Session["sayfaTuru"]);            
ClientScript.RegisterStartupScript(this.GetType(), "RefreshOpener", "f2(" + i + ")", true);
</code></pre>

<hr>

<pre><code>function f2(i) {
            if (i == 1) {//CariKartHareketleri
                opener.document.getElementById("HiddenField1").value = "hello world";
                window.opener.location.href = window.opener.location.href; //çağıran sayfayı yeniliyor

            }
            else if (i == 2) {//islemler
                opener.document.getElementById("HiddenField1").value = "hello world";
                window.opener.__doPostBack('GridRefreshPanel.ClientID', '');

            }
            else if (i == 3) {//hizmet listesi
                opener.document.getElementById("HiddenField1").value = "hello world";
                window.opener.__doPostBack('GridRefreshPanel.ClientID', '');

            }

        } 
</code></pre>

<p>it says <code>i</code> is undefined when I debug the code in <code>f2(i)</code>.What am i doing wrong?</p>

<p><strong>EDIT:</strong> I learned many things from this problem,  but I still do not have an answer.I tried every idea given in the answers but <code>i</code> is still <code>undefined</code>...</p>

<p><strong>EDIT:</strong> I still have no solution for undefined reasons :), but the answer I accepted would normally be my solution.</p>
