OnLoad event is taking too long when a button is clicked on page

Shrinivas Sarmane asked on June 15, 2020 10:29

Hi Everyone,

We have a page having a button

Top - <%@ Register Src="~/CMSWebParts/TechDogs/SavedForLater/Add.ascx" TagPrefix="ucsfl" TagName="SaveForLater" %>
Body - <cms:CMSUpdatePanel ID="udpReading" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
Button - <ucsfl:SaveForLater runat="server" ID="savedForLater" />

The button click logic file Add.ascx is as follows

<asp:UpdatePanel ID="UpdatePanelSaveForLater" runat="server" UpdateMode="Conditional">
<ContentTemplate>
    <asp:LinkButton CssClass="save-for-later-btn" runat="server" ID="LnkSaveForLater" OnClick="LnkSaveForLater_Click" ValidationGroup="savedformore"><span class="fa fa-star-o"></span> Save for Later</asp:LinkButton>
    <asp:LinkButton class="added-to" runat="server" ID="LnkSavedForLater" OnClick="LnkSavedForLater_Click" ValidationGroup="savedformore"><span class="fa fa-star"></span> Saved for Later</asp:LinkButton>
</ContentTemplate></asp:UpdatePanel>

We enabled Request debug logs and found out that OnLoad is taking 15 seconds to execute.

Screenshots are attached.

Screenshot

Can anybody help us to understand whats going wrong?

Thanks in advance Shrinivas

Recent Answers


David te Kloese answered on June 15, 2020 10:49 (last edited on June 15, 2020 10:50)

few things:

Since you're displaying URLs in your screenshot, those are accessible so not sure if you want it to be publicly available.

I see the page itself also makes additional 380(!) requests on images...

Since it requires a login I can't check the actual button click you say, but the page itself takes ages to load too..

As you mention it's this button and it's stored in a folder WebParts I assume it's a Web Part? If you remove it does it become quick again?

What does the Web Part do? Any caching applied? Could you share (some of) the code for the Add.ascx.cs file?

0 votesVote for this answer Mark as a Correct answer

Shrinivas Sarmane answered on June 15, 2020 18:07 (last edited on June 15, 2020 18:11)

Hi, Thanks for your reply. We have below WebPart for button

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Add.ascx.cs" Inherits="CMSWebParts_TechDogs_SharedForLater_Add" %>

<cms:CMSUpdatePanel ID="UpdatePanelSaveForLater" runat="server" UpdateMode="Conditional">
<ContentTemplate>
    <asp:LinkButton CssClass="save-for-later-btn" runat="server" ID="LnkSaveForLater" OnClick="LnkSaveForLater_Click" ValidationGroup="savedformore"><span class="fa fa-star-o"></span> Save for Later</asp:LinkButton>
    <asp:LinkButton class="added-to" runat="server" ID="LnkSavedForLater" OnClick="LnkSavedForLater_Click" ValidationGroup="savedformore"><span class="fa fa-star"></span> Saved for Later</asp:LinkButton>
</ContentTemplate></cms:CMSUpdatePanel>

We observed that, when we click on this button and its calling the OnLoad of parent page. In foreground we cant see page reloading but it seems in background its reloading that parent page.

And below is the backend code for Add.ascx.cs file

public partial class CMSWebParts_TechDogs_SharedForLater_Add : CMSAbstractWebPart
{
#region Events

protected void Page_Load(object sender, EventArgs e)

Can you help us understand this?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.