I'm creating a small community site, where users can enable or disable partial rendering by setting their profile property (it is needed because not all browsers support AJAX yet). I added ScriptManager to a masterpage. And added the code to enable or disable
partial rendering to the masterpage's Page_Load. But I've got this error:
Cannot change the value of EnablePartialRendering on ScriptManager or ScriptManagerProxy after PreInit.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Cannot change the value of EnablePartialRendering on ScriptManager or ScriptManagerProxy after PreInit.
The problem is that masterpage doesn't support Page_PreInit event. Is there any way to enable or disable partial rendering from within a master page based on the user's profile settings
(without adding PreInit code to the every page of the site)?
well i think that won't work because according to the message, it has to be done unit the preinit work. my suggestion is to build a base page that does that in the preinit event (and then this page will serve as base to all the other pages that exist on
the site).
--
Regards,
Luis Abreu
email: labreu_at_gmail.com
EN blog:http://msmvps.com/blogs/luisabreu
Oops, sorry about that, I was thinking that it would work because the master page OnInit fires before content page PreInit. However, what I forgot about was that the scriptmanager declaration was in the master page! d'oh... Is there no method in the master
page lifecycle which gets called before OnInit?
well, as i recall it, no you cannot because after firing the preinit event, the page applies the master and then it fires the init event. that's why you can alter the master dinamically until the preinit event :(
--
Regards,
Luis Abreu
email: labreu_at_gmail.com
EN blog:http://msmvps.com/blogs/luisabreu
Roman Shumik...
Member
119 Points
25 Posts
Changing ScriptManager's property EnablePartialRendering from a masterpage
Apr 04, 2006 05:58 AM|LINK
Hi,
I'm creating a small community site, where users can enable or disable partial rendering by setting their profile property (it is needed because not all browsers support AJAX yet). I added ScriptManager to a masterpage. And added the code to enable or disable partial rendering to the masterpage's Page_Load. But I've got this error:
Cannot change the value of EnablePartialRendering on ScriptManager or ScriptManagerProxy after PreInit.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Cannot change the value of EnablePartialRendering on ScriptManager or ScriptManagerProxy after PreInit.
The problem is that masterpage doesn't support Page_PreInit event. Is there any way to enable or disable partial rendering from within a master page based on the user's profile settings (without adding PreInit code to the every page of the site)?
Thank you in advance,
Roman
djmutiny
Member
225 Points
45 Posts
Re: Changing ScriptManager's property EnablePartialRendering from a masterpage
Apr 04, 2006 09:34 AM|LINK
Perhaps try using OnInit in the master page, as the master page is initialised before the page class.
Something along the lines of:
protected void OnInit(EventArgs e)
{
myScriptManager.EnablePartialRendering = userLikesPartialRendering;
}
Thanks,
Carlos
Luis Abreu
All-Star
25674 Points
5369 Posts
MVP
Re: Changing ScriptManager's property EnablePartialRendering from a masterpage
Apr 04, 2006 11:21 AM|LINK
hello.
well i think that won't work because according to the message, it has to be done unit the preinit work. my suggestion is to build a base page that does that in the preinit event (and then this page will serve as base to all the other pages that exist on the site).
Regards,
Luis Abreu
email: labreu_at_gmail.com
EN blog:http://msmvps.com/blogs/luisabreu
djmutiny
Member
225 Points
45 Posts
Re: Changing ScriptManager's property EnablePartialRendering from a masterpage
Apr 04, 2006 11:57 AM|LINK
Luis Abreu
All-Star
25674 Points
5369 Posts
MVP
Re: Changing ScriptManager's property EnablePartialRendering from a masterpage
Apr 04, 2006 01:19 PM|LINK
hello.
well, as i recall it, no you cannot because after firing the preinit event, the page applies the master and then it fires the init event. that's why you can alter the master dinamically until the preinit event :(
Regards,
Luis Abreu
email: labreu_at_gmail.com
EN blog:http://msmvps.com/blogs/luisabreu
Roman Shumik...
Member
119 Points
25 Posts
Re: Changing ScriptManager's property EnablePartialRendering from a masterpage
Apr 05, 2006 12:52 AM|LINK
Everybody, thank you for help!
I probably will use the base class approach ;-)
BTW I have found this link http://odetocode.com/Blogs/scott/archive/2005/12/09/2604.aspx
Is it possible to use the method described there?
Roman
Luis Abreu
All-Star
25674 Points
5369 Posts
MVP
Re: Changing ScriptManager's property EnablePartialRendering from a masterpage
Apr 05, 2006 10:21 AM|LINK
hello.
yes, you can...
Regards,
Luis Abreu
email: labreu_at_gmail.com
EN blog:http://msmvps.com/blogs/luisabreu
sATsvelKe
Member
124 Points
185 Posts
Re: Changing ScriptManager's property EnablePartialRendering from a masterpage
Feb 05, 2013 11:20 PM|LINK
how to change the property of script manage on timer tick .I am getting error
The EnablePartialRendering property cannot be changed after the Init event.
any solution for this thanksi advance