PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → Multiple calling of Page Initialisation when load a page
Multiple calling of Page Initialisation when load a page
Iniciado por Simon PHILLIPS, 09,ene. 2021 13:57 - 3 respuestas
Miembro registrado
32 mensajes
Popularité : +1 (1 vote)
Publicado el 09,enero 2021 - 13:57
Hi all

I'm not sure if this should be happening, but I have found that when a page is loaded into the browser, the Initializing of page_??? server event is called 5 times.

This happens on every page, so what I am finding is if I put any calls to the server to read/update files in this code, then it means that it calls it 5 times when really it should be just the once.

Is this normal? I am using AWP mode for the pages and find that it happens if I open a page from another page in the site, or I call the page directly from WinDev (i.e. not from the main menu.

The browser load event happens only once.

In short, should I simply move all the code in the Initializing of Page_???? into an Ajax enabled local procedure and then call it via AjaxExecute from the Browser Load event?

--
Simon Phillips
OtterReg Software
Miembro registrado
32 mensajes
Popularité : +1 (1 vote)
Publicado el 09,enero 2021 - 14:08
Just to add a footnote to this, the Global declarations (server) is also called 5 times.

--
Simon Phillips
OtterReg Software
Miembro registrado
32 mensajes
Popularité : +1 (1 vote)
Publicado el 09,enero 2021 - 14:50
After more investigation, I have found that all the pages on my site are based on a page template. When I have tested the calls when the pages are using the template, then it does multiple Initializations. If I just create a blank page and run that, it just does the one which is what I would have expected. I then created a new template based page with nothing on it except the template controls and it again did five refreshes.

The template has 2 loopers on it, but I have copied those onto the blank non-template page, and it works fine. I have check all the code in the template and there is nothing which would cause a page initialization.

Any ideas what could be causing this would be gratefully received.

--
Simon Phillips
OtterReg Software
Miembro registrado
32 mensajes
Popularité : +1 (1 vote)
Publicado el 11,enero 2021 - 20:44
Ok found out what it is. Any call to the server will cause this, even if a button with no code or action is clicked, then the Page_initializing and Page Global declarations are run. This also happens if AjaxExecute is called from browser code regardless of the options that are applied.

--
Simon Phillips
OtterReg Software