Introduction
Today, in this article let's play around with one of the interesting and most useful concepts in SharePoint 2010.
Question: What is a content type?
In simple terms "Content types are a reusable set of columns which can be used across multiple lists or libraries. It is called central component to manage metadata".
I think we are now good to go and implement this wonderful concept.
Step 1: Open SharePoint 2010 Central Administration and navigate to the specific site.
Step 2: Open up Visual Studio 2010 and try to select an empty sharepoint project:

Step 3: Select deploy as a farm solution and click on the next - button. Now an empty project will be created:

Step 4: Add a new visual webpart for that project.

Step 5: The complete code of the visualwebpart1usercontrol.ascx looks like this:
<%@ Assembly="" Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly="" Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register="" TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register="" TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register="" TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import="" Namespace="Microsoft.SharePoint" %>
<%@ Register="" TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control="" Language="C#" AutoEventWireup="true" CodeBehind="VisualWebPart1UserControl.ascx.cs"Inherits="ContentTypesProgramaticallyApp.VisualWebPart1.VisualWebPart1UserControl" %>
<div>
<center>
<table style="font-family: Verdana; font-weight: bold; color: brown;">
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Please Enter Content Type Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Please Enter First Column Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Please Enter Second Column Name"></asp:Label>




Join the conversation! Your thoughts help the community grow.