PDA

View Full Version : [CLOSED] How can I get this destroy call to render in a DirectEvent?



michaeld
Jan 05, 2014, 3:43 AM
I do not know why but I cannot get this destroy to render. I suspect it's because it's not attached to a parent control


( new Hidden() {
ID = "App." + ctlID,
IDMode = IDMode.Static
} ).Destroy();

michaeld
Jan 05, 2014, 10:35 PM
I think I have found the solution. This will render if I add the Hidden to Page.Controls.

Still, as a slightly different question related to the same. I'm wondering, is there a way to push X.AddScript or other render to beginning of the returned stream in a DirectEvent?

Daniil
Jan 06, 2014, 1:46 PM
Hi @michaeld,

For example,

X.AddScript("alert(1);");
X.AddScript("alert(2);");

Do you need "alert(2)" to be executed before "alert(1)"?

Maybe, this way:

X.AddScript("alert(1);");
X.ResourceManager.RegisterBeforeClientInitScript("alert(2);");