1
我想打印基於GridView的報表複選框。如果選擇了3行,應該是3個報告。我的代碼是這樣的...如何使用ASP.NET GridView,RDLC打印多個報表?
protected void btn_Print_Click(object sender, EventArgs e)
{
if (IsPostBack)
{
try
{
foreach (GridViewRow gvr in grdRV.Rows)
{
RadioButton rbID = (RadioButton)gvr.FindControl("rbID") as RadioButton;
if (rbID != null && rbID.Checked)
{
string sID = grdRV.DataKeys[gvr.RowIndex].Value.ToString().Trim();
if (rbl_Print.SelectedValue == "0")
{
SMTP(sID);
}
else if (rbl_Print.SelectedValue == "1")
{
Material(sID);
}
}
}
}
catch (Exception ex)
{
Session["error"] = ex.Message;
Response.Redirect("MessageBoard.aspx");
}
}
}
private void Material(string sID)
{
string querystring = "../pmis/Reports/RptRFQMatV.aspx?RFQNo=" + lblRFQNo.Text.ToString() + "&ID=" + sID;
Random r = new Random();
string Script = "";
Script += "<script language=JavaScript id='PopupWindow'>";
Script += "confirmWin = window.open(' " + querystring + "','" + r.Next() + "','scrollbars=yes,resizable=1, width=960,height=500,left=50,top=130,status');";
Script += "confirmWin.Setfocus()</script>";
//ClientScript.RegisterStartupScript(typeof(string), "PopupScript", "PopupWindow");
if (!ClientScript.IsClientScriptBlockRegistered("PopupWindow"))
ClientScript.RegisterClientScriptBlock(typeof(string), "PopupWindow", Script);
}
當前這段代碼可以打印報告最後一行......誰能幫我?謝謝
當您在此代碼中設置斷點時會發生什麼?爲什麼它沒有抓住你期望的3? – 2011-01-20 05:43:21
@ p.campbell:讓我說我檢查了3行,我會有3個ID。例如:A0031,A0027,A0051。所以首先A0031進入材料塊,完成A0027後,然後A0051。所以報告只適用於A0051。其他兩個ID不出來。可能會被覆蓋或其他東西... – CMMaung 2011-01-20 06:01:16