Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

TagMapCollection Class

Contains a collection of TagMapInfo objects.

Namespace: System.Web.Configuration
Assembly: System.Web (in system.web.dll)
public sealed class TagMapCollection : ConfigurationElementCollection
public final class TagMapCollection extends ConfigurationElementCollection
public final class TagMapCollection extends ConfigurationElementCollection
Not applicable.

The TagMapInfo class allows you to remap the types of tags at compile time. This remapping causes the mapped type to be used in place of the original tag type for all pages and controls in the ASP.NET application in the scope of the configuration file.

The TagMapCollection class allows you to programmatically access and modify the tagMapping subsection of the pages section of a configuration file. Within the tagMapping subsection, you can add and remove mappings between tag types by specifying the fully qualified strong names of the types.

NoteNote:

Unlike other attributes and collections in the pages section, tag remapping has no matching ASP.NET page directive.

The following configuration file excerpt shows how to declaratively specify values for several properties of the TagMapCollection type.

<system.web>
  <pages>
    <tagMapping>
      <clear />
      <add
        tagType=
          "System.Web.UI.WebControls.WebParts.WebPartManager"
        mappedTagType=
          "Microsoft.Sharepoint.WebPartPartManager, 
           MSPS.Web.dll, Version='2.0.0.0'" 
      />
      <remove tagType="SomeOtherNS.Class, Assemblyname" />
    </tagMapping>
   </pages>
</system.web>

The following code example shows how to use the TagMapCollection class to programmatically modify tag-mapping settings. This code example is part of a larger example provided for the PagesSection class.

// Get all current TagMappings in the collection.
for (int i = 0; i < pagesSection.TagMapping.Count; i++)
{
  Console.WriteLine("TagMapping {0}:", i);
  Console.WriteLine("  TagTypeName = '{0}'",
      pagesSection.TagMapping[i].TagType);
  Console.WriteLine("  MappedTagTypeName = '{0}'",
      pagesSection.TagMapping[i].MappedTagType);
}

// Add a TagMapInfo object using a constructor.
pagesSection.TagMapping.Add(
    new System.Web.Configuration.TagMapInfo(
    "MyNameSpace.MyControl", "MyNameSpace.MyOtherControl"));

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.