本文整理匯總了VB.NET中System.Web.UI.HtmlTextWriter.AddAttribute方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET HtmlTextWriter.AddAttribute方法的具體用法?VB.NET HtmlTextWriter.AddAttribute怎麽用?VB.NET HtmlTextWriter.AddAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.UI.HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.AddAttribute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1:
' Set attributes and values along with attributes and styles
' attribute defined for a <span> element.
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('Hello');")
writer.AddAttribute("CustomAttribute", "CustomAttributeValue")
writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "Red")
writer.AddStyleAttribute("CustomStyle", "CustomStyleValue")
writer.RenderBeginTag(HtmlTextWriterTag.Span)
' Create a space and indent the markup inside the
' <span> element.
writer.WriteLine()
writer.Indent += 1
示例2:
' Control the encoding of attributes.
' Simple known values do not need encoding.
writer.AddAttribute(HtmlTextWriterAttribute.Alt, "Encoding, ""Required""", True)
writer.AddAttribute("myattribute", "No "encoding " required", False)
writer.RenderBeginTag(HtmlTextWriterTag.Img)
writer.RenderEndTag()
writer.WriteLine()