How I pass parameters to SSRS Report from CodeBehind in VB.Aspx project.

Aypn CNN 446 Reputation points
2021-10-10T16:23:21.953+00:00

Hi,

Pls, help me to share your ideas with some samples on passing parameters to SSRS, I'm unable to get results when passing parameter values from Code Behind.

  • ref my below code; Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        If Not Page.IsPostBack Then
    
            AttendanceId = Request.QueryString("_RecordId")
    
            ReportViewer1.ProcessingMode = ProcessingMode.Remote
    
            Dim serverReport As ServerReport
            serverReport = ReportViewer1.ServerReport
    
            serverReport.ReportServerUrl = New Uri("http://00.0.0.0:00/Reports/")
            serverReport.ReportPath = "/f_SSRS/StudentAttendanceReport"
    
            Dim parameter As New ReportParameter()
            Parameter.Name = "@i_AttendanceId"
            Parameter.Values.Add(AttendanceId)
    
            Set the report parameters for the report  
            Dim parameters() As ReportParameter = {parameter}
            serverReport.SetParameters(parameters)
            Dim parameters As List(Of ReportParameter) = New List(Of ReportParameter)
            parameters.Add(New ReportParameter("AttendanceId", AttendanceId))
            ReportViewer1.ServerReport.SetParameters(parameters)
            ReportViewer1.LocalReport.SetParameters(parameters)
        End If
    
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,254 questions
{count} votes