0

我在两个不同的页面上有一个更新面板。我想在两个页面上使用相同的用户控件,并使用 asyncpostbacktrigger 将其分配给更新面板。它在开发环境中运行良好,但是当我们将其放入实时站点时会出现 java 脚本错误。

我知道您不能在多个更新面板中使用相同的用户控件,但是这有什么问题吗?

谢谢你。

编辑:

这是我第一页的代码:

<%@ Page Title="" Language="C#" MasterPageFile="~/Licensing.Master" AutoEventWireup="true" CodeBehind="VendorLicenses.aspx.cs" Inherits="Licensing.Web.ManageLicenses.VendorLicenses" %>
<%@ Register Src="~/ManageLicenses/OwnerLicenseEdit.ascx" TagName="LicenseEdit" TagPrefix="licensing" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function EditLicense(LicenseID) {
            // set title
            if (LicenseID == "")
            {
                $get('<%= LicensePanelHeaderText.ClientID %>').innerHTML = "Add License";
                $get('<%= LicenseEditDelete.ClientID %>').style.display = "none";
            }
            else
            {
                $get('<%= LicensePanelHeaderText.ClientID %>').innerHTML = "Edit License";
                $get('<%= LicenseEditDelete.ClientID %>').style.display = "";
            }

            <%= Page.ClientScript.GetPostBackEventReference(LicenseEdit, "[LicenseID]").Replace("'[LicenseID]'", "LicenseID") %>
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ajax:ToolkitScriptManager runat="server" ID="ScriptManager" />

    <font style="font-weight:bold; font-size:large;">Vendor Licenses</font>
    <br /><br />

<!-- License Popup -->
&nbsp<a href='javascript:EditLicense("");'>Add License</a>
<asp:LinkButton runat="server" ID="AddLicense" style="display:none;" />

<asp:Panel ID="LicensePanel" runat="server" style="display:none; width:100%;" CssClass="modalPopup">
    <asp:Panel ID="LicensePanelHeader" runat="server" HorizontalAlign="Center">
        <asp:Label runat="server" ID="LicensePanelHeaderText" style="font-weight:bold; font-size:large; text-decoration:underline;"></asp:Label>
    </asp:Panel>
    <br />

    <asp:UpdatePanel ID="LicenseUpdatePanel" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="LicenseEdit" />
            <asp:AsyncPostBackTrigger ControlID="LicenseEditSave" />
            <asp:AsyncPostBackTrigger ControlID="LicenseEditDelete" />
        </Triggers>
        <ContentTemplate>
            <licensing:LicenseEdit runat="server" ID="LicenseEdit" OnLicenseLoaded="LicenseEdit_OnLicenseLoaded" />
        </ContentTemplate>
    </asp:UpdatePanel>

这是我的第二页的代码:

<%@ Page Title="" Language="C#" MasterPageFile="~/Licensing.Master" AutoEventWireup="true" CodeBehind="OwnerLicenses.aspx.cs" Inherits="Licensing.Web.ManageLicenses.OwnerLicenses" %>
<%@ Register Src="~/ManageLicenses/OwnerLicenseEdit.ascx" TagName="LicenseEdit" TagPrefix="licensing" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function EditLicense(LicenseID) {
            // set title
            if (LicenseID == "")
            {
                $get('<%= LicensePanelHeaderText.ClientID %>').innerHTML = "Add License";
                $get('<%= LicenseEditDelete.ClientID %>').style.display = "none";
            }
            else
            {
                $get('<%= LicensePanelHeaderText.ClientID %>').innerHTML = "Edit License";
                $get('<%= LicenseEditDelete.ClientID %>').style.display = "";
            }

            <%= Page.ClientScript.GetPostBackEventReference(LicenseEdit, "[LicenseID]").Replace("'[LicenseID]'", "LicenseID") %>
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ajax:ToolkitScriptManager runat="server" ID="ScriptManager" />

    <font style="font-weight:bold; font-size:large;">Prasco Licenses</font>
    <br /><br />

<!-- License Popup -->
&nbsp<a href='javascript:EditLicense("");'>Add License</a>
<asp:LinkButton runat="server" ID="AddLicense" style="display:none;" />

<asp:Panel ID="LicensePanel" runat="server" style="display:none; width:100%;" CssClass="modalPopup">
    <asp:Panel ID="LicensePanelHeader" runat="server" HorizontalAlign="Center">
        <asp:Label runat="server" ID="LicensePanelHeaderText" style="font-weight:bold; font-size:large; text-decoration:underline;"></asp:Label>
    </asp:Panel>
    <br />

    <asp:UpdatePanel ID="LicenseUpdatePanel" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="LicenseEdit" />
            <asp:AsyncPostBackTrigger ControlID="LicenseEditSave" />
            <asp:AsyncPostBackTrigger ControlID="LicenseEditDelete" />
        </Triggers>
        <ContentTemplate>
            <licensing:LicenseEdit runat="server" ID="LicenseEdit" OnLicenseLoaded="LicenseEdit_OnLicenseLoaded" />
        </ContentTemplate>
    </asp:UpdatePanel>
4

0 回答 0