1

我正在研究 AsyncPostback 触发器,当我输入 url 时它工作正常

本地主机:49208/default.aspx

但是当我从 url 事件处理程序中删除 default.aspx 时,不会调用。这是我的代码

<asp:UpdatePanel ID="UPCompanyNews" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
            <ContentTemplate>
                <div id="ComUploaderImgDiv" class="cr-lodr" runat="server">
                    <asp:Image ID="ComUploaderImg" runat="server" ImageUrl="~/Images/busy.gif" />
                </div>

                <div id="ComCarouselDiv" style="background-color: #FFFFFF;" runat="server">
                    <carousel:CompanyNews ID="CarouselCompanyNews" runat="server" EnableViewState="true" />

                </div>

            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="hiddenComNewsAsyTrigger" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
        <asp:Button ID="hiddenComNewsAsyTrigger" runat="server" Text="AsyncUpdate" Style="display: none;" OnClick="LoadCompanyCarouselTrigger" />

事件处理程序代码

protected void LoadCompanyCarouselTrigger(object sender, EventArgs e)
    {
        try
        {
            CarouselCompanyNews.LoadCompanyNewsCarousel();
            ComUploaderImgDiv.Style["display"] = "none";
            ComCarouselDiv.Style["display"] = "block";
            LoadClientActivityTrigger();
            LoadMyStatTrigger(sender, e);
            LoadEventTrigger(sender, e);

        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
4

0 回答 0