當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET WebPartTransformer類代碼示例

本文整理匯總了VB.NET中System.Web.UI.WebControls.WebParts.WebPartTransformer的典型用法代碼示例。如果您正苦於以下問題:VB.NET WebPartTransformer類的具體用法?VB.NET WebPartTransformer怎麽用?VB.NET WebPartTransformer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了WebPartTransformer類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: GetStringValue

' An interface that the transformer provides to the consumer.
<AspNetHostingPermission(SecurityAction.Demand, _
   Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
   Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Interface IString
    Sub GetStringValue(ByVal callback As StringCallback)
End Interface
開發者ID:VB.NET開發者,項目名稱:System.Web.UI.WebControls.WebParts,代碼行數:8,代碼來源:WebPartTransformer

示例2: RowToStringTransformer

' 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
開發者ID:VB.NET開發者,項目名稱:System.Web.UI.WebControls.WebParts,代碼行數:52,代碼來源:WebPartTransformer


注:本文中的System.Web.UI.WebControls.WebParts.WebPartTransformer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。