Click here to Skip to main content
15,903,030 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
this is the code,which works absolutely fine on local host but it's not working on another machine where i am accessing same application with the help of iis server
and
Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"-FY15-16"+".pdf");


this above mentioned code i am using to generate file name dynamically but this also working on local host finely and onto another machine it;s not generating file name its taking only "IND" not rest of the lable name and "-FY15-16" string and also generating file into .dat format
can any one help me out,please
int QuotationId = Convert.ToInt32(Session["QuotationId"]);
           lbl_QuotationId.Text = QuotationId.ToString();
           CrystalReportViewer1.Visible = true;
           SqlConnection connection = new SqlConnection(CS);
           SqlConnection connection1 = new SqlConnection(CS);
           connection.Open();
           SqlCommand command = new SqlCommand("Select QuotationId,Comp_CompanyName,Comp_CompanyCity,Comp_CompanyAddress,comp_Pin,comp_ContactNo,cust_CustomerName,Desccription,Price,Quantity,LineTotal,Country,DeliveryPeriod,Excise,Taxes,Freight,PayementTerms,RexrothPartNo From quotation where QuotationId=" + lbl_QuotationId.Text.Trim() + "", connection);
           SqlDataAdapter adapter = new SqlDataAdapter(command);
           FinalQuotation1 dataset = new FinalQuotation1();
           adapter.Fill(dataset);
           ReportDocument Report = new ReportDocument();
           Report.Load(Server.MapPath("FinalQuotationReport.rpt"));
           Report.SetDataSource(dataset.Tables[1]);
           CrystalReportViewer1.ReportSource = Report;
           Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"-FY15-16"+".pdf");


please help,
Thanks in Advance
Posted
Updated 9-Dec-15 1:28am
v2

1 solution

Instead of hyphen (-) use underscore (_) and your problem should be resolved.
File naming with certain special characters sometimes creates problem on different browsers (generally). I am not sure about the root cause though.

Something like-
C#
Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"_FY15_16"+".pdf");


Hope, it helps :)
 
Share this answer
 
v3
Comments
Madhav Gunjal 10-Dec-15 0:38am    
thanks suvendu for ur valuable response actually m using hyphen(-) because its required for generating file name like "IND 001-FY15-16" but still i will try your suggesion

And Thanks
Madhav Gunjal 11-Dec-15 4:49am    
i have tested same application on internet explorer there its working finely,the problem arises when i run this in Mozilla so how do i solve this issue??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900