I have a application which uses webparts and 1 control is also a Script Control.
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 Ht
View Complete Post