C# 如何在浏览器的新选项卡中打开webform页?
在GridView中,我绑定了列,所以通过单击名称列,我必须在新的表单页面中打开他/她的信息,该页面必须在新窗口中打开,那么如何操作呢 我试过很多类似的方法C# 如何在浏览器的新选项卡中打开webform页?,c#,C#,在GridView中,我绑定了列,所以通过单击名称列,我必须在新的表单页面中打开他/她的信息,该页面必须在新窗口中打开,那么如何操作呢 我试过很多类似的方法 protected void gridCustomer_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "VIEW") { int row = Convert.ToInt32(e.CommandArgum
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");
}
}
protectedvoid gridCustomer\u行命令(对象发送方,GridViewCommandEventArgs e)
{
如果(例如CommandName==“视图”)
{
int row=Convert.ToInt32(e.CommandArgument);
会话[“UserId”]=行;
//ScriptManager.RegisterStartupScript(第页,类型为(第页),“OpenWindow”,“window.open”(“../Update Pages/RegCustUpdateAndDelete.aspx',target=”_blank');”,true);
Response.Write(“window.open('../updatepages/RegCustUpdateAndDelete.aspx',“\u blank”);”;
//Write(“window.opener.location.href=window.opener.location.href”);
//RegisterStartupScript(this,GetType(),“refresh”,“window.setTimeout('window.location.reload(true);',5000);”,true);
//Response.End();
//重定向(“CustomerSearch.aspx”);
}
}
几天前它是工作的,但现在不是工作的代码。我认为如果您使用Itemtemplate将网格列作为链接或超链接,并将目标属性设置为空会更好。使用下面的代码
ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('../Update Pages/RegCustUpdateAndDelete.aspx','_blank');", true);
希望这将对您有所帮助。Iam使用链接按钮。那么如何将目标属性用作_blank。?在使用代码隐藏的特定方法后,是否可以这样做?