ScriptManager 和 Ajax Control Toolkit 出现 this._form is null 错误

发布于 2024-09-18 15:12:36 字数 2846 浏览 3 评论 0原文

我在 VS2008 中使用 Ajax Control Toolkit 和 .NET 在我的页面上放置一个评级控件。我在页面上安装了脚本管理器,并且评级控件可以在 Chrome 和 IE 中运行,但不能在 Firefox 中运行。在 Firefox 中,它给我这个错误“this._form is null”。我的页面上没有包含其他脚本。母版页中包含一些内容,但它们以 关闭。我尝试过使用 ToolkitScriptManager 但它没有改变任何东西。

   <form id="aspnetForm" runat="server"><ajaxToolkit:ToolkitScriptManager id="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" EnablePartialRendering="true" SupportsPartialRendering="true" />
<div id="main" align='center'>

<div id="inside">
<div id="nav">
    <div id="photoCount"><label id="lblPhotoCount" runat="server"></label></div>
    <div id="photoNav">
        <a class="nav_a" runat="server" id="previouslink" href="">Previous</a><a class="nav_a" runat="server" id="nextlink" href="">Next</a> 
    </div>
    <div class="clear"></div>
</div>
<div id="divBrowseBox" runat="server">
    <div id='divPicHeader' runat='server' style="z-index: 2998">
    </div>
</div>

<div id="likeArea">
  <iframe id="likeIframe" runat="server" src="" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>
</div>

<div id="ratingArea">
    <asp:updatepanel id="UpdatePanel1" runat="server">
        <ContentTemplate>
        <asp:HiddenField ID="hdnCurrentPhotoID" runat="server" />
        <asp:HiddenField ID="hdnCurrentRating" runat="server" />
        <asp:HiddenField ID="hdnAvgRating" runat="server" />
        <asp:HiddenField ID="hdnTotalVotes" runat="server" />
        <asp:HiddenField ID="hdnAddRating" runat="server" />

        <asp:Label ID="lblYourVote" runat="server" Font-Size="12px" Text="Rate This Photo!"></asp:Label>
        <div id="starbox">
        <div id="stars">
        <ajaxToolkit:Rating ID="Rating1" runat="server"
            CurrentRating="3"
            MaxRating="5"
            StarCssClass="ratingStar"
            WaitingStarCssClass="savedRatingStar"
            FilledStarCssClass="filledRatingStar"
            EmptyStarCssClass="emptyRatingStar"
            OnChanged="Rating1_Changed"
            AutoPostBack="true"
            BehaviorID="rbid"
        >
        </ajaxToolkit:Rating>
        </div>
        </div>
        <div style="clear: both;"></div>
        <asp:Label ID="lblTotalVotes" runat="server" Font-Size="10px" Text=""></asp:Label>

        </ContentTemplate>
    </asp:updatepanel>
</div>
<div style="clear: both;"></div>

</div>

</div>
</form>

用代码更新。表单上面只有一些样式而已。

I'm using the Ajax Control Toolkit with .NET in VS2008 to put a Rating control on my page. I've got the scriptmanager on the page and the rating control works in Chrome and IE but not Firefox. In Firefox it gives me this error "this._form is null". I've got no other scripts included on the page. There are a couple included in the master page but they are closed with </script>. I've tried using ToolkitScriptManager but it hasn't changed anything.

   <form id="aspnetForm" runat="server"><ajaxToolkit:ToolkitScriptManager id="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" EnablePartialRendering="true" SupportsPartialRendering="true" />
<div id="main" align='center'>

<div id="inside">
<div id="nav">
    <div id="photoCount"><label id="lblPhotoCount" runat="server"></label></div>
    <div id="photoNav">
        <a class="nav_a" runat="server" id="previouslink" href="">Previous</a><a class="nav_a" runat="server" id="nextlink" href="">Next</a> 
    </div>
    <div class="clear"></div>
</div>
<div id="divBrowseBox" runat="server">
    <div id='divPicHeader' runat='server' style="z-index: 2998">
    </div>
</div>

<div id="likeArea">
  <iframe id="likeIframe" runat="server" src="" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>
</div>

<div id="ratingArea">
    <asp:updatepanel id="UpdatePanel1" runat="server">
        <ContentTemplate>
        <asp:HiddenField ID="hdnCurrentPhotoID" runat="server" />
        <asp:HiddenField ID="hdnCurrentRating" runat="server" />
        <asp:HiddenField ID="hdnAvgRating" runat="server" />
        <asp:HiddenField ID="hdnTotalVotes" runat="server" />
        <asp:HiddenField ID="hdnAddRating" runat="server" />

        <asp:Label ID="lblYourVote" runat="server" Font-Size="12px" Text="Rate This Photo!"></asp:Label>
        <div id="starbox">
        <div id="stars">
        <ajaxToolkit:Rating ID="Rating1" runat="server"
            CurrentRating="3"
            MaxRating="5"
            StarCssClass="ratingStar"
            WaitingStarCssClass="savedRatingStar"
            FilledStarCssClass="filledRatingStar"
            EmptyStarCssClass="emptyRatingStar"
            OnChanged="Rating1_Changed"
            AutoPostBack="true"
            BehaviorID="rbid"
        >
        </ajaxToolkit:Rating>
        </div>
        </div>
        <div style="clear: both;"></div>
        <asp:Label ID="lblTotalVotes" runat="server" Font-Size="10px" Text=""></asp:Label>

        </ContentTemplate>
    </asp:updatepanel>
</div>
<div style="clear: both;"></div>

</div>

</div>
</form>

Updated with code. There are only some styles above the form and that is all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪荡不羁 2024-09-25 15:12:36

我回答了我自己的问题。我试图在表单中创建一个表单,但它不起作用。我没有从错误消息中得到任何指示,但最终弄清楚了。

I answered my own question. I was trying to create a form within a form and it wasn't working. I didn't get any indication of that from the error messages but eventually figured it out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文