Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6468521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:53:51+00:00 2026-05-25T05:53:51+00:00

I am developing a sandboxed visual webpart using SharePoint 2010 in Visual Studio 2010

  • 0

I am developing a sandboxed visual webpart using SharePoint 2010 in Visual Studio 2010 with the SharePoint powertools installed. The webpart deploys and works as expected, except that the properties are not editable. I believe that the core problem is that WebPartStorageAttribute is not available in sandbox, but haven’t been able to find guidance on how to create a sandboxed webpart with editable properties. Is this even possible?

[ToolboxItem(false)]
[XmlRoot(Namespace="MyNamespace")]
public partial class MyWebPart: System.Web.UI.WebControls.WebParts.WebPart
{
     const string  defaultStartTime = "00:30:00";
     private string _startTime = "00:30:00";

    [Browsable(true)]
    [WebBrowsable(true)]
    [Category("Timer")]
    [Description("Start time to use if the user has not set a different one.")]
    [XmlElement(ElementName="StartTime")]
    [DefaultValue(defaultStartTime)]
    [FriendlyName("Start Time")]       
    public string  StartTime
    {
        get
        {
            return _startTime;
        }
        set
        {
            _startTime = value;
        }
    }
...

Is there something missing in the above code? Is it possible to create an editable sandboxed webpart, and if so, how is it done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:53:51+00:00Added an answer on May 25, 2026 at 5:53 am

    I just went through that process and this is how I managed to have it run on under a sandbox solution and also a 365 site, this is the entire sample code:

    Note: I’m using Visual WebPart (SandBoxed) within SharePoint Power Tools for Visual Studio

    ToolPartTest.ascx:

    <h3>Selected List</h3>
    <dd><asp:Literal runat="server" ID="list" /></dd>
    

    TooLPartTest.ascx.cs:

    [WebBrowsable(true), Personalizable(true)]
    public string ListName { get; set; }
    
    protected override void OnInit(EventArgs e)
    {
      base.OnInit(e);
      InitializeControl();
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
    
    }
    
    protected override void OnPreRender(EventArgs e)
    {
      base.OnPreRender(e);
    
      list.Text = ListName ?? "(None)";
    }
    
    public override EditorPartCollection CreateEditorParts()
    {
      return new EditorPartCollection(base.CreateEditorParts(),
        new[]
        {
          new CustomEditorPart
          {
            ID = ID + "_editorPart"
          }
        }
      );
    }
    

    ToolPart.cs

    public class CustomEditorPart : EditorPart
    {
      private DropDownList _list;
    
      protected override void OnInit(EventArgs e)
      {
        base.OnInit(e);
    
        _list = new DropDownList();
        _list.AppendDataBoundItems = true;
        _list.Items.Add("");
        _list.DataTextField = "Title";
        _list.DataValueField = "Title";
        _list.DataSource = SPContext.Current.Site.RootWeb.Lists;
        _list.DataBind();
    
        Controls.Add(new LiteralControl("List: "));
        Controls.Add(_list);
    
      }
    
      public override bool ApplyChanges()
      {
        EnsureChildControls();
    
        if (!string.IsNullOrEmpty(_list.SelectedValue))
          ((ToolPartTest)WebPartToEdit).ListName = _list.SelectedValue;
    
        return true;
      }
    
      public override void SyncChanges()
      {
        EnsureChildControls();
    
        var webpart = ((ToolPartTest)WebPartToEdit);
        _list.SelectedValue = webpart.ListName;
    
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing a web application that I've registered with Twitter. In this app, I might
Developing a little survey webapp, ran into problem that deals with ranges for rating
Developing for iPhone, I have a collection of points that I need to make
I'm developing a web app that needs some sort of filesystem access. Ideally I'd
We're developing locally a facebook app that should reside in a page tab. The
Developing an application for Android, i want to record data that will be usefull
I developing a program that draws in elements of the list (QListView). How do
I am developing a system that allows userwritten javascript in widgets. To keep things
I've been developing an app that posts scores to GC leaderboards and pulls them
Hello everyone, I'm developing a photo sharing web site using the CodeIgniter PHP framework

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.