There are already several articles on
the web relating to the use of the ASP.NET UpdatePanel in sandbox solutions, so
to add to the mix, here's another one.
Sandbox solutions and the UpdatePanel: the truth of it is that you cannot use
the UpdatePanel in sandbox solutions. If you try to use it you get an error
stating "The control with ID 'UpdatePanel1' requests a ScriptManager on the
page". Using the ScriptManager.GetCurrent returns null. If you try to add your
own you get an error as you can only have one ScriptManager instance at a time.
You can add your own, however, by adding it as the first control in the
Form.Controls control tree, but even this will most likely break the page unless
you duplicate the exact scripts you may be adding to the page in code - the
symptom of this is the ScriptResource.axd that would normally contains your
scripts returns with a 404.
That aside, the reason the ScriptManager.GetCurrent doesn't return the actual
ScriptManager you have added to your page or master page is to do with the way
sandbox solutions replace some objects with its own object types. For instance,
the System.Web.UI.Page object is replaced by the SPUserCodePage object.
The question for me is why is the ScriptManager not available? Why not allow
the use of the UpdatePanel in a sandbox?
No comments:
Post a Comment