我正在开发c#程序,即将在2个标签中显示2个报告(水晶报告)。为此我尝试了response.redirect,但它只适用于第一个response.redirect。它不会进入第二个response.redirect ...有谁知道如何解决这个问题?这是我的代码:
if (Request.QueryString["ProcessName"].ToString().Equals("MyBill"))
{
using (SqlCommand cmd = new SqlCommand("MyBill", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 6000;
cmd.Parameters.Add("@id", SqlDbType.Int);
cmd.Parameters["@id"].Value = Request.QueryString["id"];
cmd.Parameters.Add("@billamount", SqlDbType.Int);
cmd.Parameters["@billamount"].Value = Request.QueryString["billamount"];
cmd.Parameters.Add("@p_displaydocno", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
cmd.Parameters.Add("@p_billno_out", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
//Print Bill
string ReportName = "Bill_New.rpt";
string billid = null;
string piping = Convert.ToString(cmd.Parameters["@p_billno_out"].Value);
string audit_no = string.Empty;
string[] strArr = null;
char[] splitchar = { '|' };
strArr = piping.Split(splitchar);
audit_no = strArr[0].Trim();
billid = strArr[1].Trim();
auditno = Convert.ToInt32(audit_no);
string URL = "./Reports/Reports.aspx?ReportName=" + ReportName + "&billid=" + billid;
Response.Redirect(URL);
//Print Receipt
string ReportName2 = "Receipt.rpt";
string DocNoFrom = null;
string DocNoTo = null;
DocNoFrom = Convert.ToString(cmd.Parameters["@p_displaydocno"].Value);
DocNoTo = Convert.ToString(cmd.Parameters["@p_displaydocno"].Value);
string URL2 = "./Reports/Reports.aspx?ReportName=" + ReportName2 + "&DocNoFrom=" + DocNoFrom + "&DocNoTo=" + DocNoTo;
Response.Redirect(URL2);
Cursor.Current = Cursors.AppStarting;
}
con.Close();
}
编辑:然后我尝试使用javascript替换response.redirect,是的,它会打开2个标签,但会出现此错误
Response.Write("<script>window.open(URL, '_blank');</script>");
Response.Write("<script>window.open(URL2, '_blank');</script>");