本文整理汇总了VB.NET中System.Web.UI.WebControls.WebParts.WebPartTransformerAttribute.WebPartTransformerAttribute构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET WebPartTransformerAttribute构造函数的具体用法?VB.NET WebPartTransformerAttribute怎么用?VB.NET WebPartTransformerAttribute使用的例子?那么, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Web.UI.WebControls.WebParts.WebPartTransformerAttribute
的用法示例。
在下文中一共展示了WebPartTransformerAttribute构造函数的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: GetRowData
' A transformer that transforms a row to a string.
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<WebPartTransformer(GetType(IWebPartRow), GetType(IString))> _
Public Class RowToStringTransformer
Inherits WebPartTransformer
Implements IString
Private _provider As IWebPartRow
Private _callback As StringCallback
Private Sub GetRowData(ByVal rowData As Object)
Dim props As PropertyDescriptorCollection = _provider.Schema
If ((Not (props Is Nothing)) AndAlso (props.Count > 0) _
AndAlso (Not (rowData Is Nothing))) Then
Dim returnValue As String = String.Empty
For Each prop As PropertyDescriptor In props
If Not (prop Is props(0)) Then
returnValue += ", "
End If
returnValue += prop.DisplayName.ToString() + ": " + _
prop.GetValue(rowData).ToString()
Next
_callback(returnValue)
Else
_callback(Nothing)
End If
End Sub
Public Overrides Function Transform(ByVal providerData As Object) As Object
_provider = CType(providerData, IWebPartRow)
Return Me
End Function
Sub GetStringValue(ByVal callback As StringCallback) _
Implements IString.GetStringValue
If (callback Is Nothing) Then
Throw New ArgumentNullException("callback")
End If
If (Not (_provider Is Nothing)) Then
_callback = callback
_provider.GetRowData(New RowCallback(AddressOf GetRowData))
Else
callback(Nothing)
End If
End Sub
End Class