1
votes

I want to make a drop down control, an HTML select/dropdown box with two specific values. I want to package it so that I can deploy it to any SharePoint 2010 server I want, for its generic. At this point, I am confused if this should be a Visual WebPart, or a Web Control (does this exist in SharePoint 2010, Web Controls?). I would like the person ultimately using it to be able to place the control anywhere they like, including a non-webpart zone. Any help it getting me going is appreciated...

1

1 Answers

4
votes

First, it'll help to mention that a WebPart or a Visual WebPart is, at its heart, a Web Control.

A Visual Web Part combines in one a WebPart and a UserControl with a designer surface, which brings Web Part development into a realm comfortable to a lot of us old ASP.NET developers.

If you want your user to be able to place the control in places other than web part zones, they'll need tools. It is possible to do this in SharePoint Designer, provided you are willing to provide both the control and the training.

In general, it will require that you develop the component, call it MyControl, either as a bare-bones web control or as a web part. Provide to your users instructions for registering the control's namespace at the top of the page layout via an @Register directive like this:

<@ Register TagPrefix="customcontrols" Namespace="My.WebControls.Namespace" Assembly="My.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0101010101010" %>

Then your user can add it to the page layout as they would an ASP.NET page:

<customcontrols:MyControl runat="server" />

For most users, this will be a hefty bite to chew; however, no one knows your people better than you, so you can decide whether this will do or whether developing a web part for use in web part zones is better.