How to implement Tags in your web project.

Please click here to download the source code if you want.

========================================================================
  ASP.NET APPLICATION : Tags Project Overview
========================================================================

/////////////////////////////////////////////////////////////////////////////
Use:

  The project illustrates how to impliment tags.

/////////////////////////////////////////////////////////////////////////////
Create Database:

Setp1. Create a Database in SQL Server 2008 and name it as OceanCMS.

Setp2. Create data table with this SQL Script.

USE [OceanCMS]
GO
/****** Object:  Table [dbo].[cms_Tags] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cms_Tags](
 [TagID] [uniqueidentifier] NOT NULL,
 [TagName] [nvarchar](50) NOT NULL,
 [CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_cms_Tags] PRIMARY KEY CLUSTERED
(
 [TagID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF,
 ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[cms_Articles] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cms_Articles](
 [ArticleID] [uniqueidentifier] NOT NULL,
 [Title] [nvarchar](100) NOT NULL,
 [Details] [nvarchar](max) NOT NULL,
 [LastModifyDate] [datetime] NOT NULL,
 [CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_cms_Articles] PRIMARY KEY CLUSTERED
(
 [ArticleID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[cms_ArticleMappingTags]******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cms_ArticleMappingTags](
 [ArticleID] [uniqueidentifier] NOT NULL,
 [TagID] [uniqueidentifier] NOT NULL,
 [CreateDate] [datetime] NOT NULL,
 CONSTRAINT [PK_cms_ArticlesInTags] PRIMARY KEY CLUSTERED
(
 [ArticleID] ASC,
 [TagID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF,
 ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Default [DF_cms_ArticlesInTags_CreateDate]******/
ALTER TABLE [dbo].[cms_ArticleMappingTags] ADD  CONSTRAINT
[DF_cms_ArticlesInTags_CreateDate]  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_cms_Articles_ArticleID]******/
ALTER TABLE [dbo].[cms_Articles] ADD  CONSTRAINT [DF_cms_Articles_ArticleID]
  DEFAULT (newid()) FOR [ArticleID]
GO
/****** Object:  Default [DF_cms_Articles_LastModifyDate]******/
ALTER TABLE [dbo].[cms_Articles] ADD  CONSTRAINT [DF_cms_Articles_LastModifyDate]
  DEFAULT (getdate()) FOR [LastModifyDate]
GO
/****** Object:  Default [DF_cms_Articles_CreateDate]******/
ALTER TABLE [dbo].[cms_Articles] ADD  CONSTRAINT [DF_cms_Articles_CreateDate]
  DEFAULT (getdate()) FOR [CreateDate]
GO
/****** Object:  Default [DF_cms_Tags_TagID]******/
ALTER TABLE [dbo].[cms_Tags] ADD  CONSTRAINT [DF_cms_Tags_TagID]
  DEFAULT (newid()) FOR [TagID]
GO
/****** Object:  Default [DF_cms_Tags_CreateDate]******/
ALTER TABLE [dbo].[cms_Tags] ADD  CONSTRAINT [DF_cms_Tags_CreateDate]
DEFAULT (getdate()) FOR [CreateDate]
GO


Code Logical:

Step1. Create a C# ASP.NET Web Application in Visual Studio 2010 and name it
as OceanCMS.

Step2. Add ADO.NET Entity Data Model and name it as OceanCMS.edmx.

Setp3. Use Microsoft Visual Studio Wizard to generate the code for OceanCMS.edmx
 from database.

Part I. Entity Data Model Schema.

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="OceanCMSModel.Store" Alias="Self"
  Provider="System.Data.SqlClient" ProviderManifestToken="2008"
   xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator"
    xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="OceanCMSModelStoreContainer">
          <EntitySet Name="cms_ArticleMappingTags"
    EntityType="OceanCMSModel.Store.cms_ArticleMappingTags"
    store:Type="Tables" Schema="dbo" />
          <EntitySet Name="cms_Articles" EntityType="OceanCMSModel.Store.cms_Articles"
    store:Type="Tables" Schema="dbo" />
          <EntitySet Name="cms_Tags" EntityType="OceanCMSModel.Store.cms_Tags"
    store:Type="Tables" Schema="dbo" />
        </EntityContainer>
        <EntityType Name="cms_ArticleMappingTags">
          <Key>
            <PropertyRef Name="ArticleID" />
            <PropertyRef Name="TagID" />
          </Key>
          <Property Name="ArticleID" Type="uniqueidentifier" Nullable="false" />
          <Property Name="TagID" Type="uniqueidentifier" Nullable="false" />
          <Property Name="CreateDate" Type="datetime" Nullable="false" />
        </EntityType>
        <EntityType Name="cms_Articles">
          <Key>
            <PropertyRef Name="ArticleID" />
          </Key>
          <Property Name="ArticleID" Type="uniqueidentifier" Nullable="false" />
          <Property Name="Title" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="Details" Type="nvarchar(max)" Nullable="false" />
          <Property Name="LastModifyDate" Type="datetime" Nullable="false" />
          <Property Name="CreateDate" Type="datetime" Nullable="false" />
        </EntityType>
        <EntityType Name="cms_Tags">
          <Key>
            <PropertyRef Name="TagID" />
          </Key>
          <Property Name="TagID" Type="uniqueidentifier" Nullable="false" />
          <Property Name="TagName" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="CreateDate" Type="datetime" Nullable="false" />
        </EntityType>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="OceanCMSModel" Alias="Self"
   xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation"
   xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="OceanCMSEntities" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="cms_Articles" EntityType="OceanCMSModel.cms_Article" />
          <EntitySet Name="cms_Tags" EntityType="OceanCMSModel.cms_Tag" />
          <EntitySet Name="cms_ArticleMappingTags"
     EntityType="OceanCMSModel.cms_ArticleMappingTag" />
        </EntityContainer>
        <EntityType Name="cms_Article">
          <Key>
            <PropertyRef Name="ArticleID" />
          </Key>
          <Property Name="ArticleID" Type="Guid" Nullable="false" />
          <Property Name="Title" Type="String" Nullable="false"
    MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="Details" Type="String" Nullable="false"
     MaxLength="Max" Unicode="true" FixedLength="false" />
          <Property Name="LastModifyDate" Type="DateTime" Nullable="false" />
          <Property Name="CreateDate" Type="DateTime" Nullable="false" />
        </EntityType>
        <EntityType Name="cms_Tag">
          <Key>
            <PropertyRef Name="TagID" />
          </Key>
          <Property Name="TagID" Type="Guid" Nullable="false" />
          <Property Name="TagName" Type="String" Nullable="false"
    MaxLength="50" Unicode="true" FixedLength="false" />
          <Property Name="CreateDate" Type="DateTime" Nullable="false" />
        </EntityType>
        <EntityType Name="cms_ArticleMappingTag">
          <Key>
            <PropertyRef Name="ArticleID" />
            <PropertyRef Name="TagID" />
          </Key>
          <Property Type="Guid" Name="ArticleID" Nullable="false" />
          <Property Type="Guid" Name="TagID" Nullable="false" />
          <Property Type="DateTime" Name="CreateDate" Nullable="false" />
        </EntityType>
      </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="OceanCMSModelStoreContainer"
  CdmEntityContainer="OceanCMSEntities">
          <EntitySetMapping Name="cms_Articles"><EntityTypeMapping
    TypeName="OceanCMSModel.cms_Article">
    <MappingFragment StoreEntitySet="cms_Articles">
            <ScalarProperty Name="ArticleID" ColumnName="ArticleID" />
            <ScalarProperty Name="Title" ColumnName="Title" />
            <ScalarProperty Name="Details" ColumnName="Details" />
            <ScalarProperty Name="LastModifyDate" ColumnName="LastModifyDate" />
            <ScalarProperty Name="CreateDate" ColumnName="CreateDate" />
          </MappingFragment></EntityTypeMapping></EntitySetMapping>
          <EntitySetMapping Name="cms_Tags"><EntityTypeMapping
    TypeName="OceanCMSModel.cms_Tag"><MappingFragment StoreEntitySet="cms_Tags">
            <ScalarProperty Name="TagID" ColumnName="TagID" />
            <ScalarProperty Name="TagName" ColumnName="TagName" />
            <ScalarProperty Name="CreateDate" ColumnName="CreateDate" />
          </MappingFragment></EntityTypeMapping></EntitySetMapping>
          <EntitySetMapping Name="cms_ArticleMappingTags">
            <EntityTypeMapping TypeName="OceanCMSModel.cms_ArticleMappingTag">
              <MappingFragment StoreEntitySet="cms_ArticleMappingTags">
                <ScalarProperty Name="CreateDate" ColumnName="CreateDate" />
                <ScalarProperty Name="TagID" ColumnName="TagID" />
                <ScalarProperty Name="ArticleID" ColumnName="ArticleID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
        </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
    <Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </Connection>
    <Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
        <DesignerProperty Name="EnablePluralization" Value="False" />
        <DesignerProperty Name="IncludeForeignKeysInModel" Value="True" />
      </DesignerInfoPropertySet>
    </Options>
    <!-- Diagram content (shape and connector positions) -->
    <Diagrams>
      <Diagram Name="OceanCMS">
        <EntityTypeShape EntityType="OceanCMSModel.cms_Article"
  Width="1.5" PointX="0.75" PointY="0.75" Height="1.9802864583333331" IsExpanded="true" />
        <EntityTypeShape EntityType="OceanCMSModel.cms_Tag"
  Width="1.5" PointX="0.75" PointY="3.125" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="OceanCMSModel.cms_ArticleMappingTag"
  Width="1.5" PointX="2.75" PointY="0.875" Height="1.5956835937499996" />
      </Diagram>
    </Diagrams>
  </Designer>
</edmx:Edmx>

Part II. Code.

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Data.EntityClient;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;

[assembly: EdmSchemaAttribute()]

namespace OceanCMS
{
    #region Contexts
   
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class OceanCMSEntities : ObjectContext
    {
        #region Constructors
   
        /// <summary>
        /// Initializes a new OceanCMSEntities object using the connection string
  /// found in the 'OceanCMSEntities' section of the application configuration file.
        /// </summary>
        public OceanCMSEntities() : base("name=OceanCMSEntities", "OceanCMSEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
   
        /// <summary>
        /// Initialize a new OceanCMSEntities object.
        /// </summary>
        public OceanCMSEntities(string connectionString) : base(connectionString, "OceanCMSEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
   
        /// <summary>
        /// Initialize a new OceanCMSEntities object.
        /// </summary>
        public OceanCMSEntities(EntityConnection connection) : base(connection, "OceanCMSEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
   
        #endregion
   
        #region Partial Methods
   
        partial void OnContextCreated();
   
        #endregion
   
        #region ObjectSet Properties
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<cms_Article> cms_Articles
        {
            get
            {
                if ((_cms_Articles == null))
                {
                    _cms_Articles = base.CreateObjectSet<cms_Article>("cms_Articles");
                }
                return _cms_Articles;
            }
        }
        private ObjectSet<cms_Article> _cms_Articles;
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<cms_Tag> cms_Tags
        {
            get
            {
                if ((_cms_Tags == null))
                {
                    _cms_Tags = base.CreateObjectSet<cms_Tag>("cms_Tags");
                }
                return _cms_Tags;
            }
        }
        private ObjectSet<cms_Tag> _cms_Tags;
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<cms_ArticleMappingTag> cms_ArticleMappingTags
        {
            get
            {
                if ((_cms_ArticleMappingTags == null))
                {
                    _cms_ArticleMappingTags =
     base.CreateObjectSet<cms_ArticleMappingTag>("cms_ArticleMappingTags");
                }
                return _cms_ArticleMappingTags;
            }
        }
        private ObjectSet<cms_ArticleMappingTag> _cms_ArticleMappingTags;

        #endregion
        #region AddTo Methods
   
        /// <summary>
        /// Deprecated Method for adding a new object to the cms_Articles EntitySet.
  /// Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddTocms_Articles(cms_Article cms_Article)
        {
            base.AddObject("cms_Articles", cms_Article);
        }
   
        /// <summary>
        /// Deprecated Method for adding a new object to the cms_Tags EntitySet.
  /// Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddTocms_Tags(cms_Tag cms_Tag)
        {
            base.AddObject("cms_Tags", cms_Tag);
        }
   
        /// <summary>
        /// Deprecated Method for adding a new object to the cms_ArticleMappingTags EntitySet.
  /// Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddTocms_ArticleMappingTags(cms_ArticleMappingTag cms_ArticleMappingTag)
        {
            base.AddObject("cms_ArticleMappingTags", cms_ArticleMappingTag);
        }

        #endregion
    }
   

    #endregion
   
    #region Entities
   
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="OceanCMSModel", Name="cms_Article")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class cms_Article : EntityObject
    {
        #region Factory Method
   
        /// <summary>
        /// Create a new cms_Article object.
        /// </summary>
        /// <param name="articleID">Initial value of the ArticleID property.</param>
        /// <param name="title">Initial value of the Title property.</param>
        /// <param name="details">Initial value of the Details property.</param>
        /// <param name="lastModifyDate">Initial value of the LastModifyDate property.</param>
        /// <param name="createDate">Initial value of the CreateDate property.</param>
        public static cms_Article Createcms_Article(global::System.Guid articleID,
  global::System.String title, global::System.String details,
  global::System.DateTime lastModifyDate, global::System.DateTime createDate)
        {
            cms_Article cms_Article = new cms_Article();
            cms_Article.ArticleID = articleID;
            cms_Article.Title = title;
            cms_Article.Details = details;
            cms_Article.LastModifyDate = lastModifyDate;
            cms_Article.CreateDate = createDate;
            return cms_Article;
        }

        #endregion
        #region Primitive Properties
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid ArticleID
        {
            get
            {
                return _ArticleID;
            }
            set
            {
                if (_ArticleID != value)
                {
                    OnArticleIDChanging(value);
                    ReportPropertyChanging("ArticleID");
                    _ArticleID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ArticleID");
                    OnArticleIDChanged();
                }
            }
        }
        private global::System.Guid _ArticleID;
        partial void OnArticleIDChanging(global::System.Guid value);
        partial void OnArticleIDChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Details
        {
            get
            {
                return _Details;
            }
            set
            {
                OnDetailsChanging(value);
                ReportPropertyChanging("Details");
                _Details = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Details");
                OnDetailsChanged();
            }
        }
        private global::System.String _Details;
        partial void OnDetailsChanging(global::System.String value);
        partial void OnDetailsChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime LastModifyDate
        {
            get
            {
                return _LastModifyDate;
            }
            set
            {
                OnLastModifyDateChanging(value);
                ReportPropertyChanging("LastModifyDate");
                _LastModifyDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("LastModifyDate");
                OnLastModifyDateChanged();
            }
        }
        private global::System.DateTime _LastModifyDate;
        partial void OnLastModifyDateChanging(global::System.DateTime value);
        partial void OnLastModifyDateChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreateDate
        {
            get
            {
                return _CreateDate;
            }
            set
            {
                OnCreateDateChanging(value);
                ReportPropertyChanging("CreateDate");
                _CreateDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreateDate");
                OnCreateDateChanged();
            }
        }
        private global::System.DateTime _CreateDate;
        partial void OnCreateDateChanging(global::System.DateTime value);
        partial void OnCreateDateChanged();

        #endregion
   
    }
   
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="OceanCMSModel", Name="cms_ArticleMappingTag")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class cms_ArticleMappingTag : EntityObject
    {
        #region Factory Method
   
        /// <summary>
        /// Create a new cms_ArticleMappingTag object.
        /// </summary>
        /// <param name="articleID">Initial value of the ArticleID property.</param>
        /// <param name="tagID">Initial value of the TagID property.</param>
        /// <param name="createDate">Initial value of the CreateDate property.</param>
        public static cms_ArticleMappingTag Createcms_ArticleMappingTag(
  global::System.Guid articleID, global::System.Guid tagID, global::System.DateTime createDate)
        {
            cms_ArticleMappingTag cms_ArticleMappingTag = new cms_ArticleMappingTag();
            cms_ArticleMappingTag.ArticleID = articleID;
            cms_ArticleMappingTag.TagID = tagID;
            cms_ArticleMappingTag.CreateDate = createDate;
            return cms_ArticleMappingTag;
        }

        #endregion
        #region Primitive Properties
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid ArticleID
        {
            get
            {
                return _ArticleID;
            }
            set
            {
                if (_ArticleID != value)
                {
                    OnArticleIDChanging(value);
                    ReportPropertyChanging("ArticleID");
                    _ArticleID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ArticleID");
                    OnArticleIDChanged();
                }
            }
        }
        private global::System.Guid _ArticleID;
        partial void OnArticleIDChanging(global::System.Guid value);
        partial void OnArticleIDChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid TagID
        {
            get
            {
                return _TagID;
            }
            set
            {
                if (_TagID != value)
                {
                    OnTagIDChanging(value);
                    ReportPropertyChanging("TagID");
                    _TagID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TagID");
                    OnTagIDChanged();
                }
            }
        }
        private global::System.Guid _TagID;
        partial void OnTagIDChanging(global::System.Guid value);
        partial void OnTagIDChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreateDate
        {
            get
            {
                return _CreateDate;
            }
            set
            {
                OnCreateDateChanging(value);
                ReportPropertyChanging("CreateDate");
                _CreateDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreateDate");
                OnCreateDateChanged();
            }
        }
        private global::System.DateTime _CreateDate;
        partial void OnCreateDateChanging(global::System.DateTime value);
        partial void OnCreateDateChanged();

        #endregion
   
    }
   
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="OceanCMSModel", Name="cms_Tag")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class cms_Tag : EntityObject
    {
        #region Factory Method
   
        /// <summary>
        /// Create a new cms_Tag object.
        /// </summary>
        /// <param name="tagID">Initial value of the TagID property.</param>
        /// <param name="tagName">Initial value of the TagName property.</param>
        /// <param name="createDate">Initial value of the CreateDate property.</param>
        public static cms_Tag Createcms_Tag(global::System.Guid tagID,
  global::System.String tagName, global::System.DateTime createDate)
        {
            cms_Tag cms_Tag = new cms_Tag();
            cms_Tag.TagID = tagID;
            cms_Tag.TagName = tagName;
            cms_Tag.CreateDate = createDate;
            return cms_Tag;
        }

        #endregion
        #region Primitive Properties
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid TagID
        {
            get
            {
                return _TagID;
            }
            set
            {
                if (_TagID != value)
                {
                    OnTagIDChanging(value);
                    ReportPropertyChanging("TagID");
                    _TagID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TagID");
                    OnTagIDChanged();
                }
            }
        }
        private global::System.Guid _TagID;
        partial void OnTagIDChanging(global::System.Guid value);
        partial void OnTagIDChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TagName
        {
            get
            {
                return _TagName;
            }
            set
            {
                OnTagNameChanging(value);
                ReportPropertyChanging("TagName");
                _TagName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TagName");
                OnTagNameChanged();
            }
        }
        private global::System.String _TagName;
        partial void OnTagNameChanging(global::System.String value);
        partial void OnTagNameChanged();
   
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreateDate
        {
            get
            {
                return _CreateDate;
            }
            set
            {
                OnCreateDateChanging(value);
                ReportPropertyChanging("CreateDate");
                _CreateDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreateDate");
                OnCreateDateChanged();
            }
        }
        private global::System.DateTime _CreateDate;
        partial void OnCreateDateChanging(global::System.DateTime value);
        partial void OnCreateDateChanged();

        #endregion
   
    }

    #endregion
   
}

Step4. Create CS(C# code file) file and name DataAccess.cs and put this code in it,

using System;
using System.Collections.Generic;
using System.Linq;
using OceanCMS;
namespace DataAccess
{
    /// <summary>
    /// Singleton Pattern for getting one instance,here for getting one
    /// ObjectContext(OceanCMSEntities)
    /// </summary>
    public class BaseEntity
    {
        private static OceanCMSEntities db;
        public static OceanCMSEntities DB
        {
            get
            {
                if (db == null)
                {
                    db = new OceanCMSEntities();
                }
                return db;
            }
            set
            {
                db = value;
            }
        }
    }
    /// <summary>
    /// Add data to database
    /// </summary>
    public class InsertEntity : BaseEntity
    {
        ExistEntity existEntity = new ExistEntity();
        GetEntity getEntity = new GetEntity();
        GetEntityList getEntityList = new GetEntityList();
        /// <summary>
        /// Add article to article table with tags
        /// </summary>
        /// <param name="Title">Article Title</param>
        /// <param name="Details">Article Details</param>
        /// <param name="TagNames">Article TagNames</param>
        public void InsertArticle(string Title,
            string Details,
            string[] TagNames)
        {
            cms_Article article = new cms_Article();
            article.ArticleID = Guid.NewGuid();
            article.Title = Title;
            article.Details = Details;
            article.CreateDate = DateTime.Now;
            article.LastModifyDate = DateTime.Now;
            // Add article to article table
            DB.cms_Articles.AddObject(article);
            DB.SaveChanges();
            // Get all tag's name
            List<string> TagNameListAll = getEntityList.GetTagNamesAll();
            // Add tag to current article
            foreach (string tagName in TagNames)
            {
                // If the tag is not exist, add the tag to tag table
                if (!TagNameListAll.Contains(tagName))
                {
                    InsertTag(tagName);
                }
                string TagID = getEntity.GetTagIDByTagName(tagName);
                // Add ArticleMappingTag to ArticleMappingTag table
                InsertArticleMappingTag(article.ArticleID.ToString(), TagID);
            }
        }
        /// <summary>
        /// Insert data to tag
        /// </summary>
        /// <param name="TagName">Tag TagName</param>
        public void InsertTag(string TagName)
        {
            if (!existEntity.ExistTag(TagName))
            {
                cms_Tag tag = new cms_Tag();
                tag.TagID = Guid.NewGuid();
                tag.TagName = TagName;
                tag.CreateDate = DateTime.Now;
                // Add tag to tag table
                DB.cms_Tags.AddObject(tag);
                DB.SaveChanges();
            }
        }
        /// <summary>
        /// Insert ArticleMappingTag to ArticleMappingTag table
        /// </summary>
        /// <param name="ArticleID">ArticleMappingTag ArticleID</param>
        /// <param name="TagID">ArticleMappingTag TagID</param>
        public void InsertArticleMappingTag(string ArticleID, string TagID)
        {
            if (!existEntity.ExistArticleMappingTag(ArticleID, TagID))
            {
                cms_ArticleMappingTag articlesMappingTag
                    = new cms_ArticleMappingTag();
                articlesMappingTag.ArticleID = new Guid(ArticleID);
                articlesMappingTag.TagID = new Guid(TagID);
                articlesMappingTag.CreateDate = DateTime.Now;
                // Add ArticleMappingTag to ArticleMappingTag table
                DB.cms_ArticleMappingTags.AddObject(articlesMappingTag);
                DB.SaveChanges();
            }
        }
    }
    /// <summary>
    /// Update data to database
    /// </summary>
    public class UpdateEntity : BaseEntity
    {
        GetEntity getEntity = new GetEntity();
        GetEntityList getEntityList = new GetEntityList();
        InsertEntity insertEntity = new InsertEntity();
        DeleteEntity deleteEntity = new DeleteEntity();
        /// <summary>
        /// Update article with Tags
        /// </summary>
        /// <param name="ArticleID">Article ArticleID</param>
        /// <param name="Tittle">Article Tittle</param>
        /// <param name="Details">Article Details</param>
        /// <param name="TagNames">Article TagNames</param>
        public void UpdateArticleByArticleID
                                            (
                                            string ArticleID,
                                            string Tittle,
                                            string Details,
                                            string[] TagNames
                                            )
        {
            // Update article
            cms_Article article = new cms_Article();
            article = getEntity.GetArticleByArticleID(ArticleID);
            article.Title = Tittle;
            article.Details = Details;
            article.LastModifyDate = DateTime.Now;
            // Get tag name list by ArticleID
            List<string> TagNameList = getEntityList.GetTagNamesByArticleID(ArticleID);
            // Get all tag name list from tag table
            List<string> TagNameListAll = getEntityList.GetTagNamesAll();
            // Update tags
            // Insert new tags
            foreach (string tagname in TagNames)
            {
                // If the tag is new one insert it to tag table
                if (!TagNameListAll.Contains(tagname))
                {
                    insertEntity.InsertTag(tagname);
                }
                // If the current article do not have the tag,
                // insert the tag to ArticleMappingTag table
                if (!TagNameList.Contains(tagname))
                {
                    insertEntity.InsertArticleMappingTag(ArticleID,
                        getEntity.GetTagIDByTagName(tagname));
                }
            }
            // Delete old tags
            foreach (string tagname in TagNameList)
            {
                // If the current article do not have the old tags,
                // delete the old tags from ArticleMappingTag table
                if (!TagNames.Contains(tagname))
                {
                    deleteEntity.DeleteArticleMappingTag(ArticleID,
                        getEntity.GetTagIDByTagName(tagname));
                }
            }

            DB.SaveChanges();
        }
    }
    /// <summary>
    /// Delete data from database
    /// </summary>
    public class DeleteEntity : BaseEntity
    {
        /// <summary>
        /// Delete ArticleMappingTag from database
        /// </summary>
        /// <param name="ArticleID">ArticleMappingTag ArticleID</param>
        /// <param name="TagID">ArticleMappingTag TagID</param>
        public void DeleteArticleMappingTag(string ArticleID, string TagID)
        {
            Guid tempArticleID = new Guid(ArticleID);
            Guid tempTagID = new Guid(TagID);
            cms_ArticleMappingTag articleMappingTag
                = DB.cms_ArticleMappingTags.Where(amt
                    => amt.ArticleID == tempArticleID &&
                    amt.TagID == tempTagID).FirstOrDefault();
            // Delete ArticleMappingTag from ArticleMappingTag table
            DB.cms_ArticleMappingTags.DeleteObject(articleMappingTag);
            DB.SaveChanges();
        }
    }
    /// <summary>
    /// Get one data from database
    /// </summary>
    public class GetEntity : BaseEntity
    {
        /// <summary>
        /// Get Tag by TagName
        /// </summary>
        /// <param name="TagName">Tag TagName</param>
        /// <returns>Tag</returns>
        public cms_Tag GetTagByTagName(string TagName)
        {
            return DB.cms_Tags.Where(tag => tag.TagName
                == TagName).FirstOrDefault();
        }
        /// <summary>
        /// Get tag by TagID
        /// </summary>
        /// <param name="TagID">Tag TagID</param>
        /// <returns>Tag</returns>
        public cms_Tag GetTagByTagID(string TagID)
        {
            Guid tempTagID = new Guid(TagID);
            return DB.cms_Tags.Where(tag => tag.TagID
                == tempTagID).FirstOrDefault();
        }
        /// <summary>
        /// Get ArticleMappingTag by ArticleID and TagID
        /// </summary>
        /// <param name="ArticleID">ArticleMappingTag ArticleID</param>
        /// <param name="TagID">ArticleMappingTag TagID</param>
        /// <returns>ArticleMappingTag</returns>
        public cms_ArticleMappingTag
            GetArticleMappingTagByArticleIDAndTagID(
            string ArticleID, string TagID)
        {
            Guid tempArticleID = new Guid(ArticleID);
            Guid tempTagID = new Guid(TagID);
            return DB.cms_ArticleMappingTags.Where(articleMappingTag =>
                articleMappingTag.ArticleID == tempArticleID &&
                articleMappingTag.TagID == tempTagID).FirstOrDefault();
        }
        /// <summary>
        /// Get TagID by TagName
        /// </summary>
        /// <param name="tagName">Tag TagID</param>
        /// <returns>TagID</returns>
        public string GetTagIDByTagName(string tagName)
        {
            return DB.cms_Tags.Where(tag =>
                tag.TagName == tagName).FirstOrDefault().TagID.ToString();
        }
        /// <summary>
        /// Get Article by ArticleID
        /// </summary>
        /// <param name="ArticleID">Article ArticleID</param>
        /// <returns>Article</returns>
        public cms_Article GetArticleByArticleID(string ArticleID)
        {
            Guid tempArticleID = new Guid(ArticleID);
            return DB.cms_Articles.Where(article =>
                article.ArticleID == tempArticleID).FirstOrDefault();
        }
    }
    /// <summary>
    /// Get data list from database
    /// </summary>
    public class GetEntityList : BaseEntity
    {
        GetEntity getEntity = new GetEntity();
        /// <summary>
        /// Get TagNames by ArticleID
        /// </summary>
        /// <param name="ArticleID">Article ArticleID</param>
        /// <returns>TagName List</returns>
        public List<string> GetTagNamesByArticleID(string ArticleID)
        {
            List<string> TagNameList = new List<string>();
            Guid tempArticleID = new Guid(ArticleID);
            List<cms_ArticleMappingTag> ArticleMappingTagList =
                DB.cms_ArticleMappingTags.Where(articleMappingTag =>
                    articleMappingTag.ArticleID == tempArticleID).ToList();
            foreach (cms_ArticleMappingTag amt in ArticleMappingTagList)
            {
                TagNameList.Add(getEntity.GetTagByTagID(
                    amt.TagID.ToString()).TagName);
            }
            return TagNameList;
        }

        /// <summary>
        /// Get Tags by ArticleID
        /// </summary>
        /// <param name="ArticleID">Article ArticleID</param>
        /// <returns>Tag List</returns>
        public List<cms_Tag> GetTagsByArticleID(string ArticleID)
        {
            List<cms_Tag> TagList = new List<cms_Tag>();
            Guid tempArticleID = new Guid(ArticleID);
            List<cms_ArticleMappingTag> ArticleMappingTagList =
                DB.cms_ArticleMappingTags.Where(articleMappingTag =>
                    articleMappingTag.ArticleID == tempArticleID).ToList();
            foreach (cms_ArticleMappingTag amt in ArticleMappingTagList)
            {
                TagList.Add(getEntity.GetTagByTagID(amt.TagID.ToString()));
            }
            return TagList;
        }

        /// <summary>
        /// Get all TagNames
        /// </summary>
        /// <returns>TagName List</returns>
        public List<string> GetTagNamesAll()
        {
            List<cms_Tag> TagList = DB.cms_Tags.ToList();
            List<string> Res = new List<string>();
            foreach (cms_Tag tag in TagList)
            {
                Res.Add(tag.TagName);
            }
            return Res;
        }
        /// <summary>
        /// Get Article list by TagName
        /// </summary>
        /// <param name="TagName">Tag TagName</param>
        /// <returns>Article List</returns>
        public List<cms_Article> GetArticlesByTagName(string TagName)
        {
            string TagID = getEntity.GetTagIDByTagName(TagName);
            Guid tempTagID = new Guid(TagID);
            List<cms_Article> Res = new List<cms_Article>();
            List<cms_ArticleMappingTag> articleMappingTagList
                = DB.cms_ArticleMappingTags.Where(amt =>
                    amt.TagID == tempTagID).ToList();
            foreach (cms_ArticleMappingTag articleMappingTag
                in articleMappingTagList)
            {
                Res.Add(getEntity.GetArticleByArticleID(
                    articleMappingTag.ArticleID.ToString()));
            }
            return Res;
        }
    }
    /// <summary>
    /// Check the data exisit or not
    /// </summary>
    public class ExistEntity : BaseEntity
    {
        GetEntity getEntity = new GetEntity();
        /// <summary>
        /// Exist Tag with TagName
        /// </summary>
        /// <param name="TagName">Tag TagName</param>
        /// <returns>true | false</returns>
        public bool ExistTag(string TagName)
        {
            bool Res = false;
            cms_Tag tag = getEntity.GetTagByTagName(TagName);
            if (tag != null)
                Res = true;
            return Res;
        }
        /// <summary>
        /// Exist ArticleMappingTag with ArticleID and TagID
        /// </summary>
        /// <param name="ArticleID">ArticleMappingTag ArticleID</param>
        /// <param name="TagID">ArticleMappingTag TagID</param>
        /// <returns>true | false</returns>
        public bool ExistArticleMappingTag(string ArticleID, string TagID)
        {
            bool Res = false;
            cms_ArticleMappingTag articleMappingTag =
                getEntity.GetArticleMappingTagByArticleIDAndTagID(
                ArticleID, TagID);
            if (articleMappingTag != null)
                Res = true;
            return Res;

        }
    }
}

Step5. Create web form and name Demo.aspx.

PartI. Demo.aspx.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Demo.aspx.cs" Inherits="OceanCMS.Demo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Tags Demo</title>
    <link href="tagclouds.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="plInsertArticles" runat="server">
            <asp:Label ID="lblInsertArticleTitle" runat="server" Text="Article Tittle:"></asp:Label>
            <asp:TextBox ID="txtInsertArticleTitle" runat="server" Width="689px"></asp:TextBox><br />
            <asp:Label ID="lblInsertArticleDetails" runat="server" Text="Article Details:"></asp:Label>
            <asp:TextBox ID="txtInsertArticleDetails" runat="server" Width="682px"></asp:TextBox><br />
            <asp:Label ID="lblInsertArticleTags" runat="server" Text="Article Tags:"></asp:Label>
            <asp:TextBox ID="txtInsertArticleTags" runat="server" Width="707px"></asp:TextBox><br />
            <asp:Button ID="btnInsertArticle" runat="server" Text="Insert" OnClick="btnInsertArticle_Click" />
        </asp:Panel>
        <asp:Panel ID="plUpdateArticles" runat="server">
            <asp:Label ID="lblUpdateArticleID" runat="server" Text="Article ID:"></asp:Label>
            <asp:TextBox ID="txtUpdateArticleID" runat="server" Width="724px"></asp:TextBox><br />
            <asp:Label ID="lblUpdateArticleTitle" runat="server" Text="Article Tittle:"></asp:Label>
            <asp:TextBox ID="txtUpdateArticleTitle" runat="server" Width="693px"></asp:TextBox><br />
            <asp:Label ID="lblUpdateArticleDetails" runat="server" Text="Article Details:"></asp:Label>
            <asp:TextBox ID="txtUpdateArticleDetails" runat="server" Width="686px"></asp:TextBox><br />
            <asp:Label ID="lblUpdateArticleTags" runat="server" Text="Article Tags:"></asp:Label>
            <asp:TextBox ID="txtUpdateArticleTags" runat="server" Width="709px"></asp:TextBox><br />
            <asp:Button ID="btnUpdateArticle" runat="server" Text="Update" OnClick="btnUpdateArticle_Click" />
        </asp:Panel>
        <asp:Panel ID="plGetArticlesByTagName" runat="server">
            <asp:Label ID="lblGetTagName" runat="server" Text="Tag Name:"></asp:Label>
            <asp:TextBox ID="txtGetTagName" runat="server" Width="689px"></asp:TextBox><br />
            <asp:Button ID="btnGetArticles" runat="server" Text="Get Articles" OnClick="btnGetArticles_Click" /><br />
            <asp:Literal ID="literalArticles" runat="server"></asp:Literal>
        </asp:Panel>
        <asp:Panel ID="plGetTagNames" runat="server">
            <asp:Label ID="lblGetArticleID" runat="server" Text="Article ID:"></asp:Label>
            <asp:TextBox ID="txtGetArticleID" runat="server" Width="689px"></asp:TextBox><br />
            <asp:Button ID="btnGetTagNames" runat="server" Text="Get Tag Names" OnClick="btnGetTagNames_Click" /><br />
            <div id="tagclould">
                <asp:Literal ID="literalTagNames" runat="server"></asp:Literal>
            </div>
        </asp:Panel>
    </div>
    </form>
</body>
</html>

PartII. Demo.aspx.cs.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
using System.Text;

namespace OceanCMS
{
    public partial class Demo : System.Web.UI.Page
    {
        // Generating a random number between 0 to 10
        Random rd = new Random();
        const int seed = 11;
        InsertEntity insertEntity = new InsertEntity();
        UpdateEntity updateEntity = new UpdateEntity();
        GetEntityList getEntityList = new GetEntityList();
        protected void btnInsertArticle_Click(object sender, EventArgs e)
        {
            // Get TagNames
            string[] TagNames = txtInsertArticleTags.Text.Split(',');
            // Insert Article with TagNames
            insertEntity.InsertArticle(txtInsertArticleTitle.Text, txtInsertArticleDetails.Text, TagNames);
        }
        protected void btnUpdateArticle_Click(object sender, EventArgs e)
        {
            // Get TagNames
            string[] TagNames = txtUpdateArticleTags.Text.Split(',');
            // Update Article with TagNames
            updateEntity.UpdateArticleByArticleID(txtUpdateArticleID.Text, txtUpdateArticleTitle.Text, txtUpdateArticleDetails.Text, TagNames);
        }

        protected void btnGetArticles_Click(object sender, EventArgs e)
        {
            // Get Article list by TagName
            List<cms_Article> articleList = getEntityList.GetArticlesByTagName(txtGetTagName.Text);
            StringBuilder sbArticleList = new StringBuilder();
            // Display Article title as link
            foreach (cms_Article article in articleList)
            {
                sbArticleList.Append("<a href='articles.aspx?ArticleID=");
                sbArticleList.Append(article.ArticleID);
                sbArticleList.Append("' >");
                sbArticleList.Append(article.Title);
                sbArticleList.Append("</a>");
                sbArticleList.Append("(");
                sbArticleList.Append(article.ArticleID);
                sbArticleList.Append(")");
            }
            literalArticles.Text = sbArticleList.ToString();
        }

        protected void btnGetTagNames_Click(object sender, EventArgs e)
        {
            // Get Tag list by ArticleID
            List<cms_Tag> TagList = getEntityList.GetTagsByArticleID(txtGetArticleID.Text);
            StringBuilder sbTagList = new StringBuilder();
            // Display TagName as link
            foreach (cms_Tag Tag in TagList)
            {
                sbTagList.Append("<a class='");
                sbTagList.Append("t" + rd.Next(seed).ToString());
                sbTagList.Append("'");
                sbTagList.Append(" href='tags.aspx?TagID=");
                sbTagList.Append(Tag.TagID);
                sbTagList.Append("' >");
                sbTagList.Append(Tag.TagName);
                sbTagList.Append("</a>");
            }
            literalTagNames.Text = sbTagList.ToString();
        }
    }
}

PartIII. Demo.aspx.designer.cs.

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace OceanCMS {
   
   
    public partial class Demo {
       
        /// <summary>
        /// form1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlForm form1;
       
        /// <summary>
        /// plInsertArticles control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Panel plInsertArticles;
       
        /// <summary>
        /// lblInsertArticleTitle control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblInsertArticleTitle;
       
        /// <summary>
        /// txtInsertArticleTitle control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtInsertArticleTitle;
       
        /// <summary>
        /// lblInsertArticleDetails control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblInsertArticleDetails;
       
        /// <summary>
        /// txtInsertArticleDetails control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtInsertArticleDetails;
       
        /// <summary>
        /// lblInsertArticleTags control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblInsertArticleTags;
       
        /// <summary>
        /// txtInsertArticleTags control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtInsertArticleTags;
       
        /// <summary>
        /// btnInsertArticle control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button btnInsertArticle;
       
        /// <summary>
        /// plUpdateArticles control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Panel plUpdateArticles;
       
        /// <summary>
        /// lblUpdateArticleID control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblUpdateArticleID;
       
        /// <summary>
        /// txtUpdateArticleID control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtUpdateArticleID;
       
        /// <summary>
        /// lblUpdateArticleTitle control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblUpdateArticleTitle;
       
        /// <summary>
        /// txtUpdateArticleTitle control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtUpdateArticleTitle;
       
        /// <summary>
        /// lblUpdateArticleDetails control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblUpdateArticleDetails;
       
        /// <summary>
        /// txtUpdateArticleDetails control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtUpdateArticleDetails;
       
        /// <summary>
        /// lblUpdateArticleTags control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblUpdateArticleTags;
       
        /// <summary>
        /// txtUpdateArticleTags control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtUpdateArticleTags;
       
        /// <summary>
        /// btnUpdateArticle control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button btnUpdateArticle;
       
        /// <summary>
        /// plGetArticlesByTagName control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Panel plGetArticlesByTagName;
       
        /// <summary>
        /// lblGetTagName control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblGetTagName;
       
        /// <summary>
        /// txtGetTagName control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtGetTagName;
       
        /// <summary>
        /// btnGetArticles control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button btnGetArticles;
       
        /// <summary>
        /// literalArticles control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Literal literalArticles;
       
        /// <summary>
        /// plGetTagNames control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Panel plGetTagNames;
       
        /// <summary>
        /// lblGetArticleID control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblGetArticleID;
       
        /// <summary>
        /// txtGetArticleID control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtGetArticleID;
       
        /// <summary>
        /// btnGetTagNames control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button btnGetTagNames;
       
        /// <summary>
        /// literalTagNames control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Literal literalTagNames;
    }
}

Step6. Create CSS(Style file) file and name tagclouds.css.

#tagclould
{
    margin: 0;
    list-style: none;
}
#tagclould a
{
    margin:0 10px;
    border: 1px solid #ffffff;
}
#tagclould a:hover
{
    background: #FFC20E;
    border-left: 1px solid #ffffff;
    border-top: 1px solid #ffffff;
    border-right: 1px solid #999999;
    border-bottom: 1px solid #999999;
}

.t1
{
    color: #797979;
    font-size: 120%;
}
.t2
{
    color: #6d6d6d;
    font-size: 160%;
}
.t3
{
    color: #616161;
    font-size: 190%;
}
.t4
{
    color: #555555;
    font-size: 210%;
}
.t5
{
    color: #484848;
    font-size: 230%;
}
.t6
{
    color: #3c3c3c;
    font-size: 250%;
}
.t7
{
    color: #303030;
    font-size: 270%;
}
.t8
{
    color: #242424;
    font-size: 290%;
}
.t9
{
    color: #181818;
    font-size: 310%;
}
.t10
{
    color: #990000;
    font-size: 330%;
}


/////////////////////////////////////////////////////////////////////////////
References:
Retrieving posts by their tag
http://forums.asp.net/p/1603918/4091271.aspx

/////////////////////////////////////////////////////////////////////////////

 

 

Please click here to download the source code if you want.

 

posted @ 2010-10-25 13:26  海洋——海纳百川,有容乃大.  阅读(646)  评论(3编辑  收藏  举报