Using MicrosoftReportViewer with Web Forms programmatically
<p>I'm repeating my question because the prior one under this topic was lost.
Could you please help me? I want to use MicrosoftReportViewer for Web Forms so that the DataSource be set programmatically. There is some sample code on the Internet for Windows Forms but I haven't found anything for Web Forms. For example, here is some code I've tried to use. It gives no errors but nothing is displayed.</p>

<p>How should I modify the code to display a table in the ReportViewer?</p>

<p>Imports System.Data
Imports Microsoft.Reporting.WebForms</p>

<p>Partial Class TestReportViewer
    Inherits System.Web.UI.Page</p>

<pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    CreateReport()
End Sub

Sub CreateReport()
    Dim dt As DataTable
    Dim rpt As ReportDataSource
    dt = New DataTable("Sample")
    With dt
        .Columns.Add("No", GetType(Integer))
        .Columns.Add("Name")
        .Rows.Add(1, "A1")
        .Rows.Add(2, "A2")
        .Rows.Add(3, "A3")
        .Rows.Add(4, "A4")
        .AcceptChanges()
    End With
    rpt = New ReportDataSource
    rpt.DataMember = "Sample"
    rpt.Value = dt
    rpt.Name = "test"

    With ReportViewer1
        .LocalReport.DataSources.Add(rpt)
        .DataBind()
        .LocalReport.Refresh()
    End With
End Sub
</code></pre>

<p>End Class</p>
