SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create Web Part properties. Below is my code :

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace SP2010VisualWebPart.AmazingVisualWebPart
    public class AmazingVisualWebPart : WebPart

        private PrettyColors _textColor = PrettyColors.Black;

        public PrettyColors textColor
            get { return _textColor; }
            set { _textColor = value; }

        private const string _ascxPath = @"~/_CONTROLTEMPLATES/SP2010VisualWebPart/AmazingVisualWebPart/AmazingVisualWebPartUserControl.ascx";

        private AmazingVisualWebPartUserControl userControlReference;

        protected override void CreateChildControls()
            Control control = Page.LoadControl(_ascxPath);

            userControlReference = (AmazingVisualWebPartUserControl)control;

        protected override void OnPreRender(EventArgs e)

        public override EditorPartCollection CreateEditorParts()

            List<EditorPart> editorParts = new List<EditorPart>(1);
            EditorPart editorPart = new AmazingVisualEditorPart.AmazingVisualEditorPart();
            editorPart.ID = this.ID + "_EditorPart";

            return new EditorPartCollection(base.CreateEditorParts(), editorParts);

Below is the error I am getting

The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

How can i debug this?

share|improve this question
By the way I have the exampel from this URL… – Newbie Jul 31 '12 at 19:51
up vote 0 down vote accepted

Add using System.Collections.Generic; at the top of your code. You haven't imported the namespace.

(Or, in VS2010, right click on the List<T> object, hover on resolve, and click "add using statement")

share|improve this answer
Thanks rjcup3 allmost there, but still got this error The type or namespace name 'AmazingVisualEditorPart' could not be found (are you missing a using directive or an assembly reference?) – Newbie Jul 31 '12 at 20:38
Did you create a class for that? Is it in a different project? The rest of your code is referencing an AmazingVisualWebPart not a class named AmazingVisualEditorPart. – RJ Cuthbertson Jul 31 '12 at 20:41
Hi rjcup3 Yes you are right - its in a diffent project - Sorry my mistake – Newbie Jul 31 '12 at 21:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.