I need the ability to pass a RecordID to a report from a grid. The report is defined in a separate class (with a reference in the project containing the web forms) with the following code behind:
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports Telerik.Reporting
Imports Telerik.Reporting.Drawing
Partial Public Class GoalsCalculatorReport
Inherits Telerik.Reporting.Report
Public Sub New()
InitializeComponent()
Me.DataSource = Nothing
End Sub
Private Sub GoalsCalculatorReport_NeedDataSource(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.NeedDataSource
'Transfer the ReportParameter value to the parameter of the select command
Me.SqlDataAdapter1.SelectCommand.Parameters("@PandLID").Value = Me.ReportParameters("PandLID").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@NetProfitGoal").Value = Me.ReportParameters("NetProfitGoal").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@RaiseFeesByPct").Value = Me.ReportParameters("RaiseFeesByPct").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@IncreaseCrownsPerWeek").Value = Me.ReportParameters("IncreaseCrownsPerWeek").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@ImproveAcceptanceRatePct").Value = Me.ReportParameters("ImproveAcceptanceRatePct").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@ReduceOverheadExpensePct").Value = Me.ReportParameters("ReduceOverheadExpensePct").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@IncreaseNewPatientsFromMarketing").Value = Me.ReportParameters("IncreaseNewPatientsFromMarketing").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@IncreaseNewPatientsFromReferrals").Value = Me.ReportParameters("IncreaseNewPatientsFromReferrals").Value
'Take the Telerik.Reporting.Processing.Report instance and set the adapter as
'it's DataSource
Dim report As Telerik.Reporting.Processing.Report = CType(sender, Telerik.Reporting.Processing.Report)
report.DataSource = Me.SqlDataAdapter1
End Sub
End Class
And I've been using the following code to send grid data to another web form. I just don't know how to use a value from the grid in a report such that when I click on (a button on) a separate record of a grid, the report will show me the data for that particular record.
Protected Sub RadGridPLPS_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridPLPS.ItemCommand
Dim itmITEM As Telerik.Web.UI.GridDataItem = CType(e.Item, Telerik.Web.UI.GridDataItem)
Dim cell As TableCell = itmITEM("PandLID")
' Response.Write(cell.Text)
Select Case e.CommandName
Case "Edit"
Context.Items("PandLID") = cell.Text
Server.Transfer("PLPStatEntry.aspx")
Case "Summary"
Context.Items("PandLID") = cell.Text
Server.Transfer("Summary.aspx")
Case "Analysis"
Context.Items("PandLID") = cell.Text
Server.Transfer("PracticeAnalysis.aspx")
End Select
End Sub
I would also like to use a similar process to be able to send data from the same web form (that contains the report viewer control) to the report. For example to create my own selection criteria fields and pass them to the report.
Thank you
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports Telerik.Reporting
Imports Telerik.Reporting.Drawing
Partial Public Class GoalsCalculatorReport
Inherits Telerik.Reporting.Report
Public Sub New()
InitializeComponent()
Me.DataSource = Nothing
End Sub
Private Sub GoalsCalculatorReport_NeedDataSource(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.NeedDataSource
'Transfer the ReportParameter value to the parameter of the select command
Me.SqlDataAdapter1.SelectCommand.Parameters("@PandLID").Value = Me.ReportParameters("PandLID").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@NetProfitGoal").Value = Me.ReportParameters("NetProfitGoal").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@RaiseFeesByPct").Value = Me.ReportParameters("RaiseFeesByPct").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@IncreaseCrownsPerWeek").Value = Me.ReportParameters("IncreaseCrownsPerWeek").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@ImproveAcceptanceRatePct").Value = Me.ReportParameters("ImproveAcceptanceRatePct").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@ReduceOverheadExpensePct").Value = Me.ReportParameters("ReduceOverheadExpensePct").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@IncreaseNewPatientsFromMarketing").Value = Me.ReportParameters("IncreaseNewPatientsFromMarketing").Value
Me.SqlDataAdapter1.SelectCommand.Parameters("@IncreaseNewPatientsFromReferrals").Value = Me.ReportParameters("IncreaseNewPatientsFromReferrals").Value
'Take the Telerik.Reporting.Processing.Report instance and set the adapter as
'it's DataSource
Dim report As Telerik.Reporting.Processing.Report = CType(sender, Telerik.Reporting.Processing.Report)
report.DataSource = Me.SqlDataAdapter1
End Sub
End Class
And I've been using the following code to send grid data to another web form. I just don't know how to use a value from the grid in a report such that when I click on (a button on) a separate record of a grid, the report will show me the data for that particular record.
Protected Sub RadGridPLPS_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridPLPS.ItemCommand
Dim itmITEM As Telerik.Web.UI.GridDataItem = CType(e.Item, Telerik.Web.UI.GridDataItem)
Dim cell As TableCell = itmITEM("PandLID")
' Response.Write(cell.Text)
Select Case e.CommandName
Case "Edit"
Context.Items("PandLID") = cell.Text
Server.Transfer("PLPStatEntry.aspx")
Case "Summary"
Context.Items("PandLID") = cell.Text
Server.Transfer("Summary.aspx")
Case "Analysis"
Context.Items("PandLID") = cell.Text
Server.Transfer("PracticeAnalysis.aspx")
End Select
End Sub
I would also like to use a similar process to be able to send data from the same web form (that contains the report viewer control) to the report. For example to create my own selection criteria fields and pass them to the report.
Thank you