TagBuilder.CreateSanitizedId Method (String)
Replaces each invalid character in the tag ID with a valid HTML character.
Namespace: System.Web.Mvc
Assembly: System.Web.WebPages (in System.Web.WebPages.dll)
Syntax
'Declaration
Public Shared Function CreateSanitizedId ( _
originalId As String _
) As String
'Usage
Dim originalId As String
Dim returnValue As String
returnValue = TagBuilder.CreateSanitizedId(originalId)
public static string CreateSanitizedId(
string originalId
)
public:
static String^ CreateSanitizedId(
String^ originalId
)
static member CreateSanitizedId :
originalId:string -> string
public static function CreateSanitizedId(
originalId : String
) : String
Parameters
- originalId
Type: System.String
The ID that might contain characters to replace.
Return Value
Type: System.String
The sanitized tag ID, or null reference (Nothing in Visual Basic) if originalId is null reference (Nothing in Visual Basic) or empty, or if originalId does not begin with a letter.
Remarks
Valid characters consist of letters, numbers, and the hyphen ("-"), underscore ("_"), and colon (":") characters. All other characters are considered invalid. Each invalid character in originalId is replaced with the character specified in the HtmlHelper.IdAttributeDotReplacement property.