scropio gurl

scropio gurl

  • NA
  • 147
  • 99k

Requested requires further information in Crystal Report

Aug 12 2016 4:50 AM

 is webform in that form there is button when click on button then want to report on another form for this i create this

Webform

  1. protected void Report_Click(object sender, EventArgs e)  
  2.     {  
  3.         report_class r = new report_class();  
  4.         data crystalReport = new data();  
  5.         r.BindReport(crystalReport,Convert.ToDateTime(fromdate.Value), Convert.ToDateTime(todate.Value), regiondrop.SelectedValue);  
  6.         Response.Redirect("Reports.aspx");  
  7.   
  8.   
  9.     }  
 

then i create another class report_class

  1. public void BindReport(data crystalReport, DateTime fromdate, DateTime todate, string region)  
  2.    {  
  3.        T1 t = new T1();  
  4.        List<griddataresult_Result> dsc = t.griddataresult(fromdate, todate, region).ToList();  
  5.        DataTable dt = new DataTable();  
  6.        dt.Columns.Add("ID"typeof(int));  
  7.        dt.Columns.Add("Owner"typeof(string));  
  8.        foreach (var c in dsc)  
  9.        {  
  10.   
  11.            dt.Rows.Add(c.ID, c.Owner);  
  12.        }  
  13.   
  14.        crystalReport.DataDefinition.FormulaFields["region"].Text = "'" + region + "'";  
  15.        crystalReport.DataDefinition.FormulaFields["fromdate"].Text = "'" + fromdate + "'";  
  16.        crystalReport.DataDefinition.FormulaFields["todate"].Text = "'" + todate + "'";  
  17.        crystalReport.SetDataSource(dt);  
  18.   
  19.    }  
 

then i report.aspx i drag crystalreportviewer and i wirte this code

  1. protected void Page_Load(object sender, EventArgs e)  
  2.        {  
  3.            report_class r = new report_class();  
  4.            data crystalReport = new data();  
  5.            crystalReport.Load("data.rpt");  
  6.   
  7.            ConnectionInfo crConnectionInfo = new ConnectionInfo();  
  8.            crConnectionInfo.ServerName = "xx";  
  9.            crConnectionInfo.DatabaseName = "xx";  
  10.            crConnectionInfo.UserID = "xx";  
  11.            crConnectionInfo.Password = "xx";  
  12.            TableLogOnInfo crTableLogoninfo = new TableLogOnInfo();  
  13.   
  14.            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in crystalReport.Database.Tables)  
  15.            {  
  16.                crTableLogoninfo = CrTable.LogOnInfo;  
  17.                crTableLogoninfo.ConnectionInfo = crConnectionInfo;  
  18.                CrTable.ApplyLogOnInfo(crTableLogoninfo);  
  19.            }  
  20.   
  21.            
  22.            CrystalReportViewer1.ReportSource = crystalReport;  
  23.        CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;  
  24.            CrystalReportViewer1.DataBind();  
  25.   
  26.   
  27.             
  28.             
  29.        }  
 
 

and

  1. <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"  Height="1202px" ReportSourceID="CrystalReportSource1" ToolPanelWidth="200px" Width="1104px" ToolPanelView="None" />  
  2.   
  3.         <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">  
  4.             <Report FileName="data.rpt"
  5.             </Report>  
  6.         </CR:CrystalReportSource>  
 

So when i click on button then Reports.aspx page there is pop up appear with fields Servername,databasename,username,password so by default DataSet1 is already written in servername field , databasename field is disabled and then i write correct username and password in last 2 field when i hit enter then again pop up appear

and always appear this pop up
 
 First there

so i dont need this pop up and how to solve this ?


Answers (2)