title: Asp.Net, VB, SQL Server Reporting Services..dynamically generated reports from directory to be viewed on report viewer on click?
body: <p>I have an aspx webform that in it's vb code reads files that are .rdl from a directory and then lists them as say a button or hyper link etc. "reports are on local host report server"</p>
  
  <pre><code> Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
  Dim FileLocation As DirectoryInfo = _
  New DirectoryInfo("C:\inetpub\wwwroot\Reports")
  
  Dim fi As FileInfo() = FileLocation.GetFiles("*.rdl")
  
  For Each name As FileInfo In fi
      ' Dim i As Integer
      Dim listed As New LinkButton
      ' listed.Attributes("CssClass") = "a"
      ' listed.Attributes("Class") = "a"
      listed.Attributes("id") = "listed"
      listed.Text = (name.Name)
  
      mine.Controls.Add(listed)
      'mine.InnerHtml = ""
      'i = i + 1
  Next
  End Sub
  </code></pre>
  
  <p>and another that has a reportviewer. When a report was clicked, how can I send the name/value to the viewer and redirect to it?</p>
  
  <p>Thank you very much</p>
  
  <p>EDIT: i got to make the click redirect to the viewer with a string and have the viewer use that string,but with how much ever variation ive tried it still errors that </p>
  
  <blockquote>
    <p>The path of the item 'salesreport.rdl' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. (rsInvalidItemPath)</p>
  </blockquote>
  
  <p>this is the viewer code </p>
  
  <pre><code> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      If Not Page.IsPostBack Then
          ' Retrieve parameter from Route "Reports/{reportName}"
          Dim reportName = Picks.Selecty
  
          'Page.Title = reportName
  
          ReportViewer1.ProcessingMode = ProcessingMode.Remote
          Dim serverReport As ServerReport
          ServerReport = ReportViewer1.ServerReport
          serverReport.ReportServerUrl = New Uri("http://localhost/reportserver/")
          serverReport.ReportPath = reportName
          ' reportName
          ' 
          ' add parameters here
          'Dim param As New ReportParameter("name", "value")
          'serverReport.SetParameters(param)
  
          serverReport.Refresh()
  
      End If
  End Sub
  </code></pre>