Last post Sep 03, 2010 12:06 AM by Qin Dian Tang - MSFT
Aug 31, 2010 03:39 PM|bcweed966|LINK
I have a application which uses webparts.
So my user controls are derived from System.Web.UI.WebControls.WebParts.WebPart which makes them webparts.
I have everything setup and working fine as far as the personalization and webpart goes... every thing displays and works fine.
Except that 1 of my control needs to do a bit of work in the OnPreRender event and it turns out that event only gets fired when a user is loged in the application. That control is also a script control so it inherits from System.Web.UI.WebControls.WebParts
and also implement IScriptControl
So lets imagine that an administrator while logged in switched to 'Sharedscope' within the webpartmanager and then has added the usercontrol/webpart 'calendar' to the top webpart zone. This then makes the 'calendar' control viewable by all and any user who
visits the page wheter logged in or anonymous.
And this works fine and very well as it is supposed to. However in the 'Calendar' user control which is derived from System.Web.UI.WebControls.WebParts I have an overiden 'OnPreRender' event like this:
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
If Not Me.DesignMode Then
Me.isloaded = True
' Test for ScriptManager and register if it exists
sm = ScriptManager.GetCurrent(Page)
If sm Is Nothing Then _
Throw New HttpException("A ScriptManager control must exist on the current page.")
And this, it turns out..... only gets fired when a user is logged in. and after further testing I found out that the same is true for the 'CreateChildControls' event...
anyone knows why that is? is it something in the web.config in the webparts settings?
those are my webpart settings:
connectionStringName="LocalSqlServer" applicationName="/" />
<deny users="*" verbs="enterSharedScope" />
<allow users="*" verbs="modifyState" />
Sep 03, 2010 12:06 AM|Qin Dian Tang - MSFT|LINK
Please post the web parts issue to the thread: