0

I am binding RDLC Report viewer in my project but getting this error

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Server could not create ASP.reporting_reportvalueprediction_aspx.

Stack Trace:

[InvalidOperationException: Server could not create ASP.reporting_reportvalueprediction_aspx.] __ASP.FastObjectFactory_app_web_1r4mqrnz.Create_ASP_reporting_reportvalueprediction_aspx() +192 System.Web.Compilation.BuildResultCompiledType.CreateInstance() +31 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +104 System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33 System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) +39 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +386 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163

This is my code which I have tried


<%@ Page Language="vb" Debug="true" AutoEventWireup="false" CodeBehind="ReportValuePrediction.aspx.vb" Inherits="TimiWeb.ReportValuePrediction" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager" runat="server">
        </asp:ScriptManager>
        <div>
            
            <rsweb:ReportViewer ID="rptReportViewer" runat="server" Width="100%" Height="700px">
            </rsweb:ReportViewer>
        </div>
    </form>
</body>
</html>


 Imports Microsoft.Reporting.WebForms

Public Class ReportValuePrediction
 Inherits System.Web.UI.Page
 Private _dt As DataTable
 Public Sub New(ByVal dt As DataTable)

     _dt = dt

 End Sub
 Protected Sub Page_Load(sender As Object, e As EventArgs)

     If Not IsPostBack Then
         Dim rep As LocalReport = rptReportViewer.LocalReport
         rep.ReportPath = "/Reporting/ValuePrediction.rdlc"
         Dim rds As New ReportDataSource()

         If _dt.Rows.Count > 0 Then
             rds.Name = "ValuePredictionDS"
             rds.Value = _dt
             rep.DataSources.Add(rds)
         End If
     End If


 End Sub

End Class

1 Answer 1

0

Don't get dt values through the constructor, the value is not sustaining, pass the dt values in the page load method
and add a page load event in the report viewer from the report viewer property

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.