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
now I figured the best way to do this would be to use either response.wirte() like so
Response.Write(<script>);
Response.Write(window.open('url'));
Response.Write(</script>);
or Page.ClientScript.RegisterStartupScript() methode to call a javascript methode that would open a new page in a diffrent tab like so
Page.ClientScript.RegisterStartupScript(GetType(),"GoToURL", "<script language=JavaScript>GoToURL(" + url + ")</script>");
and the javascript looks like
<script type="text/javascript">
function GoToURL(url)
{
window.open(url);
}
</script>
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
can anyone see where I have gone wrong with this or of any other possible way to do this
Note that both of these peaces of code were exicuted inside the SelectedIndexChanged method of my drop downlist
Thanks in advance
Update 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
Thanks for all your suggestion though :)