Leo Widdo

Leo Widdo

  • NA
  • 4
  • 0

How to show report directly from asp page to pdf without viewer after click asp.net button ?

Nov 3 2008 12:59 AM

I want to ask a question  about crystal report.I have asp.net code above. Like you can see,  i am using report viewer.

The problem is i don't want using report viewer and, after i click print button in my web page the report directly show in pdf format without showing in viewer.Can Crystal report do that ?

Thanks for your help.

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim ConnInfo As New ConnectionInfo

With ConnInfo

.ServerName = "test"

.DatabaseName = "testreport"

.UserID = "user"

.Password = "xxx"

End With

Dim rep As New ReportDocument

rep.Load(Server.MapPath("~\Report\PrintSPKDetail.rpt"))

Dim RepTbls As Tables = rep.Database.Tables

For Each RepTbl As Table In RepTbls

Dim RepTblLogonInfo As TableLogOnInfo = RepTbl.LogOnInfo

RepTblLogonInfo.ConnectionInfo = ConnInfo

RepTbl.ApplyLogOnInfo(RepTblLogonInfo)

Next

Dim ParamCurrentValues As New ParameterValues

Dim NoSPKHPM As New ParameterDiscreteValue

NoSPKHPM.Value = "'" + decrypt_data(Request("NoSPKHPM")) + "'"

ParamCurrentValues.Add(NoSPKHPM)

Dim ParamFields As ParameterFieldDefinitions = rep.DataDefinition.ParameterFields

Dim PrNoSPKHPM As ParameterFieldDefinition = ParamFields("no_spkhpm")

PrNoSPKHPM.ApplyCurrentValues(ParamCurrentValues)

Me.CrystalReportViewer1.ReportSource = rep

Me.CrystalReportViewer1.DataBind()

End Sub