【问题标题】:AJAX Modal Popup Extender not shown - Sys is undefined未显示 AJAX 模态弹出扩展器 - Sys 未定义
【发布时间】:2020-01-30 08:02:11
【问题描述】:

我有一个 ASP.Net WebForms 项目(在 VS 2013 中使用 C#),我在其中调用了 AJAX Popup Extender 的一个实例。我使用 NuGet 添加了 AjaxControlToolKit 和 AjaxControlTookitStaticResources。最近,弹出表单已停止显示。当我尝试通过单击目标控件来显示弹出窗口时,它不会出现使用 FireFox 作为目标浏览器。 Firefox 控制台显示许多错误,如下所示。第一个错误是

/* Minification failed. Returning unminified contents.
(6,25981-25982): run-time error JS1014: Invalid character: \
(6,25981-25982): run-time error JS1003: Expected ':': \
(6,44631-44635): run-time error JS1197: Too many errors. The file might not be a JavaScript file: 'ss'
(6,25816-25829): run-time error JS1301: End of file encountered before function is properly closed: function(e,b)
(6,44635-44636): run-time error JS1004: Expected ';
': Z
(6,45814-45815): run-time error JS1195: Expected expression: ^
(6,45815-45816): run-time error JS1197: Too many errors. The file might not be a JavaScript file: |
 */

怎样才能让弹窗再次显示?

与弹出窗口相关的代码是

    CancelControlID="cmdCloseButton" BackgroundCssClass="modalBackground">  </cc1:ModalPopupExtender>

    <asp:Button ID="cmdTest" runat="server" Text="Test Popup" Width="177px"/> 

   <%--<asp:Button ID="cmdTest" runat="server" Text="Test Popup" Width="177px" Style="display:none" />--%> 

   <asp:Panel ID="Panl2" runat="server" Width="280px" Height="180px"  CssClass="modalPopup" align="left" style="display:none">  
        <br />&nbsp&nbsp&nbsp Need to caption multiple photos? <br /><br />
           &nbsp&nbsp&nbsp Click <a href="Why Use the Windows Downloadable Application.htm" target="_blank">here</a> for details of desktop app. <br /><br />
           &nbsp&nbsp&nbsp To hide this message and watermark on <br />
          &nbsp&nbsp&nbsp captioned photo, <a href="BuyLicense.aspx" target="_blank">buy License</a>. 

         <asp:Button ID="cmdCloseButton" runat="server" Text="Close" CssClass ="closebutton" 
             OnClick ="cmdCloseButton_Click" formnovalidate="formnovalidate" UseSubmitBehavior="false"/>  
   </asp:Panel>

Site.Master 代码是

%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="CaptionProWebMob.SiteMaster" %>

<!DOCTYPE html>
<html lang="en">
<head runat="server">
    <meta charset="utf-8" />
    <title><%: Page.Title %> Caption Pro Web</title>
    <asp:PlaceHolder runat="server">     
          <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>  
    <webopt:BundleReference runat="server" Path="~/Content/css" /> 
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />


</head>
<body>
    <form runat="server">   

        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="False">
        <Scripts>
            <%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=272931&clcid=0x409 --%>
            <%--Framework Scripts--%>

            <asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="jquery.ui.combined" />
            <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
            <%--<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
            <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
            <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
            <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
            <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
            <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
            <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
            <asp:ScriptReference Name="WebFormsBundle" />--%>
            <%--Site Scripts--%>

        </Scripts>
    </asp:ScriptManager>

    <header>
    </header>
    <div id="body"  ondragstart="dragStartHandler1(event);">
        <asp:ContentPlaceHolder runat="server" ID="FeaturedContent" >
        </asp:ContentPlaceHolder>
        <section class="content-wrapper main-content clear-fix">
            <asp:ContentPlaceHolder runat="server" ID="MainContent" >
            </asp:ContentPlaceHolder>
        </section>
    </div>
    <footer>
        <div class="content-wrapper">
            <div class="float-left">
                <p>&copy; <%: DateTime.Now.Year %> - Caption Pro Web</p>
            </div>
        </div>
    </footer>
    </form>

</body>
</html>

【问题讨论】:

    标签: javascript asp.net ajax modalpopupextender


    【解决方案1】:

    如果我将 EnableCDN="true" 添加到 Site.Master.aspx 中定义 ScriptManager1 的行中,如下所示

    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="False" EnableCdn="true" >
    

    然后弹出屏幕出现 OK。

    但是,如果 VS 项目以管理员身份运行(至少对于 Firefox),使用 AJAX AsyncFileUpLoad 将文件拖放到主窗体上现在不起作用:如果 VS 项目不是以管理员身份运行,它可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-04
      • 1970-01-01
      • 1970-01-01
      • 2012-10-22
      • 1970-01-01
      相关资源
      最近更新 更多