Share via


TagPrefixInfo.TagPrefix 屬性

定義

取得或設定與來源檔案或是命名空間及組件關聯的標記前置詞。

public:
 property System::String ^ TagPrefix { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("tagPrefix", DefaultValue="/", IsRequired=true)]
[System.Configuration.StringValidator(MinLength=1)]
public string TagPrefix { get; set; }
[<System.Configuration.ConfigurationProperty("tagPrefix", DefaultValue="/", IsRequired=true)>]
[<System.Configuration.StringValidator(MinLength=1)>]
member this.TagPrefix : string with get, set
Public Property TagPrefix As String

屬性值

String

標記前置詞。

屬性

範例

下列程式碼範例示範如何使用 TagPrefix 屬性。 此程式碼範例是提供給 類別之較大範例的 PagesSection 一部分。

// Get all current Controls in the collection.
for (int i = 0; i < pagesSection.Controls.Count; i++)
{
  Console.WriteLine("Control {0}:", i);
  Console.WriteLine("  TagPrefix = '{0}' ",
      pagesSection.Controls[i].TagPrefix);
  Console.WriteLine("  TagName = '{0}' ",
      pagesSection.Controls[i].TagName);
  Console.WriteLine("  Source = '{0}' ",
      pagesSection.Controls[i].Source);
  Console.WriteLine("  Namespace = '{0}' ",
      pagesSection.Controls[i].Namespace);
  Console.WriteLine("  Assembly = '{0}' ",
      pagesSection.Controls[i].Assembly);
}
' Get all current Controls in the collection.
Dim j As Int32
For j = 0 To pagesSection.Controls.Count - 1
  Console.WriteLine("Control {0}:", j)
  Console.WriteLine("  TagPrefix = '{0}' ", _
   pagesSection.Controls(j).TagPrefix)
  Console.WriteLine("  TagName = '{0}' ", _
   pagesSection.Controls(j).TagName)
  Console.WriteLine("  Source = '{0}' ", _
   pagesSection.Controls(j).Source)
  Console.WriteLine("  Namespace = '{0}' ", _
   pagesSection.Controls(j).Namespace)
  Console.WriteLine("  Assembly = '{0}' ", _
   pagesSection.Controls(j).Assembly)
Next

備註

屬性 TagPrefix 會定義用於控制項所在命名空間的別名。 它適用于使用者和自訂控制項。 這是在 ASP.NET 程式碼中標記名稱前面的值。 例如 中的 <myTag: myControl /> 「myTag」。

適用於

另請參閱