Kyle Bartolo

Kyle Bartolo

  • NA
  • 15
  • 16.5k

Redirecting in new Tab

Aug 23 2013 5:51 AM
Hi guys.  I need some help please as really stuck.  Have been developing in C# for some year nearly.  Im obviously still learning though i have no idea and 'unfortunately' hate java script. Im therefore kind of stuck and cant find any working solution for me.

I simply have a web page with a date from/to field, 3 checkboxes and a button.  So, you enter the dates, you select 1 or more checkboxes and you select generate. On generate, i need to simply open another web page but on a separate tab. Usually i just use response.redirect though this redirects the current web page.  I need to open on a new tab and pass in 2 parameters.

Can someone who knows this please help me out?  Im getting so frustrated as its technically something so simple with no logic what so ever. 

I have tried
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('" + url + "','_newtab');", true);

Though nothing happens.

Have also tried this which i found (to basically test a simple alert)
ScriptManager.RegisterClientScriptBlock(btnGenerate, typeof(Button), "OpenWindow", "<script> alert('Inserted successfully');</script>", true);

And still nothing happens (yes i have javascript enabled in my browser)


Thanks in advanced.

Answers (5)