Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当前上下文中不存在ReportViewer1_C#_Asp.net_Visual Studio 2012 - Fatal编程技术网

C# 当前上下文中不存在ReportViewer1

C# 当前上下文中不存在ReportViewer1,c#,asp.net,visual-studio-2012,C#,Asp.net,Visual Studio 2012,我是ASP.NET新手,正在尝试在我的网页上创建报表查看器对象。我需要向服务器传递默认身份验证。我使用的代码可以在这里找到: 以下是报表查看器的代码: <%@ Page Language="C#" AutoEventWireup="True" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %> <%@ Register Assembly="Microsoft.ReportViewer.Web

我是ASP.NET新手,正在尝试在我的网页上创建报表查看器对象。我需要向服务器传递默认身份验证。我使用的代码可以在这里找到:

以下是报表查看器的代码:

<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.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">
    <div>
        <asp:ScriptManager runat="server">   </asp:ScriptManager>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
            <ServerReport ReportPath="hoopstatist/Reports/Shooting Analysis" ReportServerUrl="https://rs2k1201.discountasp.net/reports" />
        </rsweb:ReportViewer>

    </div>
    </form>
</body>
</html>
以下是错误:

Error   1   The name 'ReportViewer1' does not exist in the current context  c:\users\nile\documents\visual studio 2012\Projects\WebApplication3\WebApplication3\WebForm1.aspx.cs    18  9   WebApplication3

检查.designer.cs文件并确保命名空间匹配,如果没有命名空间,则将其删除。这有时会使intellisense和/或builder失效。

您是否在page+load eent中尝试了相同的代码?ReportViewer是否在其他容器控件中?我已添加了web表单的所有代码。您确定CS文件属于该ASPX文件吗?看起来ASPX是WebForm1.ASPX,而CS来自Default.ASPX
Error   1   The name 'ReportViewer1' does not exist in the current context  c:\users\nile\documents\visual studio 2012\Projects\WebApplication3\WebApplication3\WebForm1.aspx.cs    18  9   WebApplication3