Running Javascript inside ASP.NET code instantly.
<p>I hope you can help me with my problem. I am executing a SQL query inside ASP.NET code and I am using bing's javascript API. Problem is that I need to do a javascript function before running a query. This function provides geocoordinates based on the address in a string format. I already know for <strong>RegisterStartupScript</strong> and <strong>RegisterClientScriptBlock</strong>, but these two don't work for me because javascript is not executing for some reason. Here is the code. And, I almost forgot, the script is declared properly at the head of the page. Is there any other way to run javascript in C# ASP.Net?</p>

<pre><code>    public void calculateCoordinates()
    {
        ClientScriptManager cs = Page.ClientScript;
        Type cstype = this.GetType();
        String csName = "Calculate";
        if (!cs.IsStartupScriptRegistered(cstype, csName))
        {
            String jsFunction = "calculateGeoCoordinates();";
            cs.RegisterStartupScript(cstype, csName, jsFunction, true);
        }
    }
</code></pre>
