Re-binding on postback - razor running before load?
I have a razor script in a macro which lists certain content nodes.
On the same page I have a form (in a user control) which on submit creates a content node in Umbraco.
My issue is that after postback, my razor script does not show the new added node. If I refresh the page, the new node appears.
When stepping through, it seems that the razor script is run before btnSubmit_Click in the code behind of my user control. In fact it is running before load
How do I re-execute the macro after my new node has been created?
Unfortunately no, this has been a "problem" for years in Umbraco or even asp.net in general. I look forward to improvements on this in Umbraco 5. For now, you'll have to stick with slightly ugly workarounds.
Re-binding on postback - razor running before load?
I have a razor script in a macro which lists certain content nodes.
On the same page I have a form (in a user control) which on submit creates a content node in Umbraco.
My issue is that after postback, my razor script does not show the new added node. If I refresh the page, the new node appears.
When stepping through, it seems that the razor script is run before btnSubmit_Click in the code behind of my user control. In fact it is running before load
How do I re-execute the macro after my new node has been created?
This is the age-old problem with usercontrols :-)
I usually work around it by redirecting back to the current page. You can check for:
That was my first thought, but surely there is a nicer way to do it. I wish there was something like macro.reinit().
Unfortunately no, this has been a "problem" for years in Umbraco or even asp.net in general. I look forward to improvements on this in Umbraco 5. For now, you'll have to stick with slightly ugly workarounds.
is working on a reply...