HtmlTextWriter.GetTagKey(String) Méthode

Définition

Obtient la valeur d'énumération HtmlTextWriterTag associée à l'élément de balisage spécifié.

protected:
 virtual System::Web::UI::HtmlTextWriterTag GetTagKey(System::String ^ tagName);
protected virtual System.Web.UI.HtmlTextWriterTag GetTagKey (string tagName);
abstract member GetTagKey : string -> System.Web.UI.HtmlTextWriterTag
override this.GetTagKey : string -> System.Web.UI.HtmlTextWriterTag
Protected Overridable Function GetTagKey (tagName As String) As HtmlTextWriterTag

Paramètres

tagName
String

Élément de balisage pour lequel obtenir HtmlTextWriterTag.

Retours

HtmlTextWriterTag

Valeur d'énumération HtmlTextWriterTag ; sinon, si le paramètre tagName n'est pas associé à une valeur HtmlTextWriterTag spécifique, Unknown.

Exemples

L’exemple de code suivant montre comment remplacer la surcharge de la RenderBeginTag méthode qui prend une chaîne comme paramètre. La chaîne est transmise à la GetTagKey méthode, qui la convertit en membre d’énumération correspondant HtmlTextWriterTag , puis passe cette chaîne à la RenderBeginTag surcharge qui prend une HtmlTextWriterTag valeur d’énumération en tant que paramètre.

virtual void RenderBeginTag( String^ tagName ) override
{
   
   // Call the overloaded RenderBeginTag(HtmlTextWriterTag) method.
   RenderBeginTag( GetTagKey( tagName ) );
}
public override void RenderBeginTag(string tagName)
{
    // Call the overloaded RenderBeginTag(HtmlTextWriterTag)
    // method.
    RenderBeginTag(GetTagKey(tagName));
}
Public Overloads Overrides Sub RenderBeginTag(ByVal tagName As String)
    ' Call the overloaded RenderBeginTag(HtmlTextWriterTag) method.
    RenderBeginTag(GetTagKey(tagName))
End Sub

Remarques

Si tagName c’est nullle cas, une chaîne vide («  ») ou introuvable dans la table des noms de balise de balisage, la GetTagKey méthode retourne le Unknown champ.

S’applique à

Voir aussi