简体   繁体   中英

How to Bring javascript Popup in Gridview selected index?

Open popup window on grid view selected index. The code work's fine but it bring a new tab I need a pop window

protected void gvUsrlist_SelectedIndexChanged(object sender, EventArgs e)
{

    Response.Write(@"<script language=""javascript"">window.open('MyCustm.aspx');</script>");

or

Response.Write(@"<script language=""javascript"">var myOpenedWindow = myOpenedWindow || window.open('MyCustm.aspx', '');</script>");

proper solution needed in java script if possible

You can pass additional parameters to window.open in doing this MOST browsers will pop open in new window instead of adding another tab.

W3 Schools Window open() Method

window.open(URL,name,specs,replace)

Example:

window.open("http://www.w3schools.com", "thisIsMyWindowName", "height=200,width=200");

if you do not want to specify window height and width just pass specs as a blank string.

window.open("http://www.w3schools.com", "thisIsMyWindowName", "");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM