简体   繁体   中英

how to open webform page in new tab of browser?

In GridView, I bound columns so by click on name column I have to open his/her information in new form page that have to open in new window so how to do it?

I tried lots like below..

protected void gridCustomer_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "VIEW")
    {
        int row = Convert.ToInt32(e.CommandArgument);
        Session["UserId"] = row;
        //ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('../Update Pages/RegCustUpdateAndDelete.aspx', target='_blank');", true);
        Response.Write("<script>window.open( '../Update Pages/RegCustUpdateAndDelete.aspx','_blank');</script>");
        //Response.Write("<script>window.opener.location.href = window.opener.location.href</script>");
        //ScriptManager.RegisterStartupScript(this, GetType(), "refresh", "window.setTimeout('window.location.reload(true);',5000);", true);
        //Response.End();
        // Response.Redirect("CustomerSearch.aspx");
    }
}

It was work some days back but now not one of code working..

我认为如果您使用Itemtemplate将网格列作为链接​​或超链接并将Target属性指定为_blank会更好。

use below code..

ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('../Update Pages/RegCustUpdateAndDelete.aspx','_blank');", true);

hope this will help you.

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