Hi
I have developed a report in CR9 which i want to display in ASP.NET WebForm. By using Crystal Web Viewer I am able to show the report. But the problem is when i navigate the Pages by clicking NEXT button, it is showing only for the First Group i.e. on my report i have Two pages for First Group. But for Second group onwards it is displaying always the 2nd page i.e. lastpage of Group1.
Can any one help me?
Here is the code on the WebForm:
Dim myReport As New RPTIntakeAddress()
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields
Dim ParameterField As CrystalDecisions.Shared.ParameterField
Dim ParameterDiscreteValue As CrystalDecisions.Shared.ParameterDiscreteValue
Dim lngRPT_ID As Long
Dim strUserID As String
Dim strPassword As String
Dim sbSQL As StringBuilder
Dim objDBUtility As DBUtility.clsDBUtility
Try
If Not IsPostBack Then
lngRPT_ID = Convert.ToInt64(context.Items("RPT_ID")
strUserID = context.Items("LoginID"
strPassword = context.Items("Password"
ViewState("RPT_ID" = lngRPT_ID
ViewState("LoginID" = strUserID
ViewState("Password" = strPassword
Else
lngRPT_ID = ViewState("RPT_ID"
strUserID = ViewState("LoginID"
strPassword = ViewState("Password"
End If
lblError.Visible = False
BtnRedirect.Visible = False
'LogonInfo
For Each myTable In myReport.Database.Tables
myLogOnInfo = myTable.LogOnInfo()
With myLogOnInfo.ConnectionInfo
.ServerName = ConfigurationSettings.AppSettings("DataSource"
.UserID = strUserID
.Password = strPassword
End With
myTable.ApplyLogOnInfo(myLogOnInfo)
If Not myTable.TestConnectivity Then
lblError.Visible = True
lblError.Text = "Error:Invalid user credentials for table:" & myTable.Name
BtnRedirect.Visible = True
End If
Next
ParameterFields = New CrystalDecisions.Shared.ParameterFields()
ParameterField = New CrystalDecisions.Shared.ParameterField()
ParameterField.ParameterFieldName = "ReportID"
ParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
ParameterDiscreteValue.Value = lngRPT_ID '3
ParameterField.CurrentValues.Add(ParameterDiscreteValue)
ParameterFields.Add(ParameterField)
CRV1.ParameterFieldInfo = ParameterFields
CRV1.ReportSource = myReport
CRV1.DisplayGroupTree = False
CRV1.HasToggleGroupTreeButton = False
CRV1.HasDrillUpButton = False
CRV1.HasSearchButton = False
Catch ex As Exception
' Just raise it.
Throw
Finally
If Not IsNothing(objDBUtility) Then
objDBUtility.Close()
End If
objDBUtility = Nothing
End Try
I have developed a report in CR9 which i want to display in ASP.NET WebForm. By using Crystal Web Viewer I am able to show the report. But the problem is when i navigate the Pages by clicking NEXT button, it is showing only for the First Group i.e. on my report i have Two pages for First Group. But for Second group onwards it is displaying always the 2nd page i.e. lastpage of Group1.
Can any one help me?
Here is the code on the WebForm:
Dim myReport As New RPTIntakeAddress()
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields
Dim ParameterField As CrystalDecisions.Shared.ParameterField
Dim ParameterDiscreteValue As CrystalDecisions.Shared.ParameterDiscreteValue
Dim lngRPT_ID As Long
Dim strUserID As String
Dim strPassword As String
Dim sbSQL As StringBuilder
Dim objDBUtility As DBUtility.clsDBUtility
Try
If Not IsPostBack Then
lngRPT_ID = Convert.ToInt64(context.Items("RPT_ID")
strUserID = context.Items("LoginID"
strPassword = context.Items("Password"
ViewState("RPT_ID" = lngRPT_ID
ViewState("LoginID" = strUserID
ViewState("Password" = strPassword
Else
lngRPT_ID = ViewState("RPT_ID"
strUserID = ViewState("LoginID"
strPassword = ViewState("Password"
End If
lblError.Visible = False
BtnRedirect.Visible = False
'LogonInfo
For Each myTable In myReport.Database.Tables
myLogOnInfo = myTable.LogOnInfo()
With myLogOnInfo.ConnectionInfo
.ServerName = ConfigurationSettings.AppSettings("DataSource"
.UserID = strUserID
.Password = strPassword
End With
myTable.ApplyLogOnInfo(myLogOnInfo)
If Not myTable.TestConnectivity Then
lblError.Visible = True
lblError.Text = "Error:Invalid user credentials for table:" & myTable.Name
BtnRedirect.Visible = True
End If
Next
ParameterFields = New CrystalDecisions.Shared.ParameterFields()
ParameterField = New CrystalDecisions.Shared.ParameterField()
ParameterField.ParameterFieldName = "ReportID"
ParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
ParameterDiscreteValue.Value = lngRPT_ID '3
ParameterField.CurrentValues.Add(ParameterDiscreteValue)
ParameterFields.Add(ParameterField)
CRV1.ParameterFieldInfo = ParameterFields
CRV1.ReportSource = myReport
CRV1.DisplayGroupTree = False
CRV1.HasToggleGroupTreeButton = False
CRV1.HasDrillUpButton = False
CRV1.HasSearchButton = False
Catch ex As Exception
' Just raise it.
Throw
Finally
If Not IsNothing(objDBUtility) Then
objDBUtility.Close()
End If
objDBUtility = Nothing
End Try