C# 当前上下文中不存在ReportViewer1
我是ASP.NET新手,正在尝试在我的网页上创建报表查看器对象。我需要向服务器传递默认身份验证。我使用的代码可以在这里找到: 以下是报表查看器的代码: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
<%@ 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