Note that there are some explanatory texts on larger screens.

plurals
  1. POcalling a javascript method from within a dropdown list asp.net
    primarykey
    data
    text
    <p>I have a drop down list that when the selected value is of a certin value I need to do some stuff and then redirect to a new page in a new tab</p> <p>now I figured the best way to do this would be to use either response.wirte() like so </p> <pre><code>Response.Write(&lt;script&gt;); Response.Write(window.open('url')); Response.Write(&lt;/script&gt;); </code></pre> <p>or Page.ClientScript.RegisterStartupScript() methode to call a javascript methode that would open a new page in a diffrent tab like so</p> <pre><code>Page.ClientScript.RegisterStartupScript(GetType(),"GoToURL", "&lt;script language=JavaScript&gt;GoToURL(" + url + ")&lt;/script&gt;"); </code></pre> <p>and the javascript looks like</p> <pre><code>&lt;script type="text/javascript"&gt; function GoToURL(url) { window.open(url); } &lt;/script&gt; </code></pre> <p>I have tried both of these and the response.write methode just coming up with unable to parse the resposnse request and nothing at all happens when I use the Page.ClientScript.RegisterStartupScript</p> <p>can anyone see where I have gone wrong with this or of any other possible way to do this </p> <p>Note that both of these peaces of code were exicuted inside the SelectedIndexChanged method of my drop downlist</p> <p>Thanks in advance</p> <p><strong>Update</strong> in the end I just caved in and filnally used a button to do the code behind and java script (got to love those onclientclick events :p) as nothing seems to be working to get java script to run from a drop down menu's onselected changed event</p> <p>Thanks for all your suggestion though :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload