Visual Webpart and Sandboxed Solutions

by Tycho Bizot 29. November 2009 13:16

I just fired up Visual Studio 2010 Beta and started the wizard to create a new Visual Webpart project for SharePoint 2010.
SharePoint 2010 has the new concept of Sandboxed Solutions, but this options is greyed out.

After choosing for the "Farm Solution" option a quick look at the code reveiled why a Visual Webpart can't be a sandboxed solution. The wizard creates a usercontrol and a webpart that loads this usercontrol, just like most developers have been doing for a long time.

protected override void CreateChildControls()
{
  
Control control = this.Page.LoadControl(_ascxPath);
   Controls.Add(control);
  
base.CreateChildControls();
}

The call to this.Page.LoadControl() can only function if the code is fully trusted, so this would never work if it was a sandboxed solution.

Looking at the code you'll also see there's no need to add ajax fixes anymore, you can just add updatepanels etc since webparts are now ajax enabled out of the box.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

2010 | Software Development | SharePoint

Comments

Comments are closed

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen