开发者

Opening a new window in asp.net

开发者 https://www.devze.com 2023-01-14 18:37 出处:网络
When i click a particular video in grid view that video should be played in a new window. When i click a video in grid view i will check cer开发者_运维技巧tain conditions in server side page. Only if

When i click a particular video in grid view that video should be played in a new window.

When i click a video in grid view i will check cer开发者_运维技巧tain conditions in server side page. Only if that condition is true i want to play that video in new window (or) tab.

If that condition is false then i want to play the selected video in the same page itself.

This is my code:

if(videoCategoryName.CategoryName=="Syndicated Videos")
{ 
  string url = www.planetwrox.com + "/" +  "default.aspx?q=videoid
  string fullURL = "window.open('www.google.com', '_blank', 'height=500,width=800');";
  ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
}

But new is not opened. instead the video plays in the same window.

Can any one provide some ideas or code to solve this issue.


Here's how I do it using jQuery:

ClientScriptManager clientScriptManager = Page.ClientScript;
string scriptText = "$(document).ready(function() { window.open('http://www.google.com'); });";
clientScriptManager.RegisterClientScriptBlock(this.GetType(), "MyScript", scriptText, true);


i can see one extra single quote before height=500, which is not closed. Is that the reason!


Try var win = window.open() instead of just window.open()

0

精彩评论

暂无评论...
验证码 换一张
取 消