Webpart - onload of child is calling onload of parent kentico in background

Shrinivas Sarmane asked on June 15, 2020 18:21

Hi Everyone,

On a page we have a button (Webpart). When we click on a button, AJAX call, in background its calling OnLoad of parent page as well. We dont see page reloading but its time is same as loading parent page. In debug we see that OnLoad is taking major time.

So is it possible that OnLoad of button CS file will call OnLoad of parent in background?

We have already reported a main problem with details - Question

Thanks in advance Shrinivas

Recent Answers

Trevor Fayas answered on June 15, 2020 21:42

Webforms is a bit tricky. If you have an ajax update panel, or an ajax updating object, what it does is it calls the page with some code to only render that element. It also needs to go through the OnInit -> OnLoad before it can render the 'click' event as the click itself is something sent in the ViewState which is "Loaded" , causing OnLoad to trigger.

This will often call the parent's onload as the child MAY need some logic from the parent. There is a way to detect when the call is in an AJAX context, i think it's ScriptManager.GetCurrent(Page).IsInAsyncPostBack;, and try to disable some of the heavier loading logic if it's an ajax call.

1 votesVote for this answer Mark as a Correct answer

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