webparts in master page

akash p asked on July 22, 2014 17:32

hello, i have a master page with various controls in it (repeaters, breadcrumb, editable text,..) and i noticed during debug that every control fires multiple times when adding breakpoints in Visual Studio and loading the webpage.

ex: the breadcrumb control (which is contained in the master page) breakpoint in protected void Page_Load method when i load the homepage the page_load event fires multiple times

how can i tell the webpart to fire only once, and as well, why does the webpart fire more than once in any case? I appreciate your input.

Recent Answers


Joshua Adams answered on July 22, 2014 18:07

Any postback is going to fire off the page load events. Maybe you could try to wrap the webparts in update panels to avoid a whole postback? In the webparts there is an ajax setting in the configuration for using an update panel, try to set this on the individual webparts and see if it helps.

0 votesVote for this answer Mark as a Correct answer

akash p answered on July 22, 2014 18:21

hello, thank you for responding quickly. i tried to set the updatepanel checkbox in Webpart->Ajax settings, however this did not work, the breakpoint was still hit multiple times. i should also mention that the reload issue is not the result of a postback, but a simple page load.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on July 22, 2014 18:44

Do you have multiple of the same controls on the page? That could cause it to be hit multiple times.

0 votesVote for this answer Mark as a Correct answer

akash p answered on July 22, 2014 18:47

No, it is a single control on the master page.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on July 22, 2014 19:14

Maybe in the cmsdesk it acts differently? Does it do the same when its on the front end without the administration interface?

0 votesVote for this answer Mark as a Correct answer

akash p answered on July 22, 2014 19:25

hi, this occurs when viewed from the end user website, as well as from cmsdesk.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 22, 2014 19:34

Because of the page lifecycle within Kentico you won't want to mess around with some of those things. Some webparts/controls load once and then need to reload the data because of the lifecycle.

If you're concerned with too many calls or performance, you can always set your caching to be a greater time per webpart or for the whole system. If you simply want to stop the additional postbacks, you'll have to program around them because that's how Kentico works.

0 votesVote for this answer Mark as a Correct answer

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