C# 在新页面asp.net C中打开最新录制的id#
我想在数据库中保存信息,并将保存的行id传递到新页面,然后下一页必须在新窗口中显示此id。我写了这段代码,但保存操作正确,显示新页面不起作用。代码如下:C# 在新页面asp.net C中打开最新录制的id#,c#,asp.net,button,webpage,C#,Asp.net,Button,Webpage,我想在数据库中保存信息,并将保存的行id传递到新页面,然后下一页必须在新窗口中显示此id。我写了这段代码,但保存操作正确,显示新页面不起作用。代码如下: protected void btnReportWaybill_Click(object sender, EventArgs e) { Session["Code"] = null; string strId = txtCode.Text.Trim(); SaveOperation(); Session["Cod
protected void btnReportWaybill_Click(object sender, EventArgs e)
{
Session["Code"] = null;
string strId = txtCode.Text.Trim();
SaveOperation();
Session["Code"] = strId;
ClientScript.RegisterClientScriptBlock(this.GetType(), "Message", "window.open('../ExportReport/DirectAWB.aspx','_blank');", true);
}
用这个
ClientScript.RegisterStartupScript(this.GetType(), "Message", "window.open('../ExportReport/DirectAWB.aspx','_blank');", true);
还要确保您在窗口中给出了正确的路径。打开。我找到了解决方案
必须像这样设置新页面的宽度和高度
ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'ExportReport/PreManifest.aspx', null, 'height=700,width=760,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);
请检查是否将其视为弹出窗口,某些浏览器可能会阻止弹出窗口不要踩踏弹出窗口,浏览器允许弹出窗口您是否检查了浏览器是否未阻止弹出窗口?