vb.net 写html,VB.NET ChtmlTextWriter类代码示例

' Create a class that derives from the

' ChtmlTextWriter class.

Imports System.IO

Imports System.Web.UI

Imports System.Web.UI.WebControls.Adapters

Namespace AspNet.Samples.VB

Public Class CustomChtmlTextWriter

Inherits ChtmlTextWriter

' Create two constructors for the new

' text writer.

Public Sub New(ByVal writer As TextWriter)

MyClass.New(writer, DefaultTabString)

End Sub

Public Sub New(ByVal writer As TextWriter, ByVal tabString As String)

MyBase.New(writer, tabString)

End Sub

' Override the OnAttributeRender method to

' not render the bgcolor attribute, which is

' not supported in CHTML.

Protected Overrides Function OnAttributeRender(ByVal name As String, ByVal value As String, ByVal key As HtmlTextWriterAttribute) As Boolean

If (String.Equals("bgcolor", name)) Then

Return False

End If

' Call the ChtmlTextWriter version of

' the OnAttributeRender method.

MyBase.OnAttributeRender(name, value, key)

End Function

End Class

' Derive from the WebControlAdapter class,

' provide a CreateCustomChtmlTextWriter

' method to attach the custom writer.

Public Class ChtmlCustomPageAdapter

Inherits WebControlAdapter

Protected Friend Function CreateCustomChtmlTextWriter( _

ByVal writer As TextWriter) As ChtmlTextWriter

Return New CustomChtmlTextWriter(writer)

End Function

End Class

End Namespace

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值