Ok, so I was wondering how long until these things start to happen… (lifecycle event shenanigans) (followed by most probably facepalms about some stupid poorly thought aspects I forgot about )
I have my “form” of various fields in a ModalDialog (Popup) inside a MarkupControl2 inside MarkupControl1 inside .dothtml page with MasterPage, each with their own VM.
Now, if I select an option in any dropdown, a fetch is made to the server (and I see on the server that it is indeed just one single request),
the Popup Load() method executes 3 then consistently 4 times in a row for each PostBack.
LE: Its other 2 overrides: Init()
not called at all; PreRender()
executes 4 times in a row. Both Init() and PreRender() are empty because I’m not using them, just using them now for debugging.
end of LE
The Load() of the parent VM executes only once.
I have emptied the Load() of the parent VM, no code in it → same, it executes only once and the other Load() 4 times in a row.
I’ve already checked that the Popup is instantiated only in one place and that code runs only once, when the Popup is opened. Afterwards it stays open, that code is no longer touched and subsequent PostaBacks repeat this behaviour of Popup Load() running 4 times in a row.
I don’t know if it means anything useful, but the DataSource of the dropdown that triggers this is inside this:
that is inside this:
that is finally inside the VM class of the MarkupControl2:
This is recipe for later disaster, as I’ve already mitigated some custom events to not get overkilled with subscribers because of this.
Now, I know I may be a skippy programmer and I must thoroughly recheck my most perfectly creations but… I thought to ask, maybe anyone has some idea about this.
LE:
How do I even properly step-hop-debug this?