页面的一部分未执行。在我的按钮上单击我生成采购订单,在同一按钮上单击我也为采购订单生成PDF。 但是为了创建该采购订单,我将控件重定向到另一个页面&在以pdf格式创建采购订单后,控件将返回到同一页面,但不幸的是我的最后一行代码没有被执行。
此行未执行。
msg_pnl.Visible = true;
我不知道为什么会这样。 谁能告诉我这个的原因?
string sell_order_number = Request.QueryString["on"].ToString();
if (String.IsNullOrEmpty(sell_order_number) == false)
{
for (int i = 0; i < Repeater1.Items.Count; i++)
{
HiddenField product_id = Repeater1.Items[i].FindControl("hf_p_id") as HiddenField;
HiddenField selling_product_id = Repeater1.Items[i].FindControl("hf_selling_product_id") as HiddenField;
HiddenField tax_id = Repeater1.Items[i].FindControl("hf_tax_id") as HiddenField;
string quantity = ((DropDownList)Repeater1.Items[i].FindControl("qty_txt")).SelectedItem.ToString();
if (quantity != null)
{
string str = "update RS_Sell_Order_Mapping set quantity ='" + quantity + "' where product_id = '" + product_id.Value + "' AND sell_order_no = '" + sell_order_number + "'";
cm.TableInsert(str);
}
//Inserting Sells Invoice Info For Storing Old Price
string InsertSellsInvoiceInfo = "insert into RS_Sells_Invoice_Info_Master (sell_order_no,product_id,selling_product_id,qty,tax_id) values('" + sell_order_number + "','" + product_id.Value + "','" + selling_product_id.Value + "','" + quantity + "','" + tax_id.Value + "')";
cm.TableInsert(InsertSellsInvoiceInfo);
}
UpdateSO_as_Created(sell_order_number);
Uri uri = HttpContext.Current.Request.Url;
String host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;
string retailer_id = Request.QueryString["rid"].ToString();
string WarehouseAddress = Request.QueryString["wid"].ToString();
string retailer_code = Request.QueryString["rcode"].ToString();
string officeAddress = Request.QueryString["oid"].ToString();
string url = host + "/pdf-sell-order/Default.aspx/?on=" + sell_order_number + "&rid=" + retailer_id + "&wid=" + WarehouseAddress + "&rcode=" + retailer_code + "&oid=" + officeAddress;
string urlToConvert = url.Trim();
// Create the PDF converter.
PdfConverter pdfConverter = new PdfConverter();
// Performs the conversion and get the pdf document bytes that can
// be saved to a file or sent as a browser response
byte[] pdfBytes = pdfConverter.GetPdfBytesFromUrl(urlToConvert);
Response.ClearHeaders();
Response.Clear();
Response.AddHeader("content-type", "application/pdf");
Response.AddHeader("content-length", pdfBytes.Length.ToString());
Response.AddHeader("content-disposition", "attachment/pdf; filename=" + sell_order_number + ".pdf");
// send the generated PDF document to client browser
// get the object representing the HTTP response to browser
HttpResponse httpResponse = HttpContext.Current.Response;
pdfConverter.SavePdfFromUrlToFile(urlToConvert, Server.MapPath("../doc/Sell-Order/" + sell_order_number + ".pdf"));
httpResponse.BinaryWrite(pdfBytes);
msg_pnl.Visible = true;