System.Web.UI.ScriptManager'没有名为'Button'的公共属性

时间:2014-02-02 12:26:31

标签: asp.net reporting-services

我尝试在asp.net网页上显示ssrsc报告,为此我搜索教程,我找到教程,显示我添加脚本管理器,reportviewer和一个按钮,当我在.aspx页面中的项目中添加这三件事时然后,当我调试我的项目,然后它显示我的错误 在这里我清楚,我不能在.aspx页面中添加ajax工具包reigster程序集为此我如何为ajax添加注册 代码

<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div align ="center" class="adminform">       
<br /><br />        
        <center>
        <div class="vpb_main_wrapper"  align="center" style="left: inherit"/><br clear="all"/>
            <asp:ScriptManager ID="ScriptManager1" runat="server">

          <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

            <rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px" 
                Width="476px">
            </rsweb:ReportViewer>
               </asp:ScriptManager> 
    </center>
    </div>

</asp:Content>

错误

Type 'System.Web.UI.ScriptManager' does not have a public property named 'Button'.

Source Error:


Line 11:             <asp:ScriptManager ID="ScriptManager1" runat="server">
Line 12:             
Line 13:           <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
Line 14: 
Line 15:             <rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px" 

1 个答案:

答案 0 :(得分:2)

问题是您将Button1ReportViewer2放在<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>之间

<asp:ScriptManager ID="ScriptManager1" runat="server">
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

    <rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px" 
            Width="476px">
    </rsweb:ReportViewer>
</asp:ScriptManager>

您需要将Button1ReportViewer2移出ScriptManager1

<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div align ="center" class="adminform">       
    <br /><br />        
        <center>
        <div class="vpb_main_wrapper"  align="center" style="left: inherit"/><br clear="all"/>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager> 
            <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
            <rsweb:ReportViewer ID="ReportViewer2" runat="server" Height="261px" 
                Width="476px">
            </rsweb:ReportViewer>
        </center>
    </div>
</asp:Content>