2013-06-25 89 views
0

我很努力將FolderID整數設置爲FolderList集合上的FolderID屬性。 FolderList綁定到外部中繼器。我看到的大多數示例都使用DataTable,而不是自定義集合。我環顧四周,實在找不到任何東西來幫助我。與內部中繼器與外部相關的內置中繼器的問題

'-------------------------------------------------------- 
'Protected Sub Page_Load() 
'-------------------------------------------------------- 
'. 
'. 
'. 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 

    '---------------------------------------------------- 
    'Output 
    '---------------------------------------------------- 
    '. 
    '. 
    '. 
    With Folders 

     '------------------------------------------------ 
     'Data 
     '------------------------------------------------ 
     '. 
     '. 
     '. 
     .DataSource = New FolderList(1) 

     '------------------------------------------------ 
     'Bind 
     '------------------------------------------------ 
     '. 
     '. 
     '. 
     .DataBind() 

    End With 

End Sub 

'-------------------------------------------------------- 
'Protected Sub Folders_ItemDataBound() 
'-------------------------------------------------------- 
'. 
'. 
'. 
Private Sub Folders_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles Folders.ItemDataBound 

    '---------------------------------------------------- 
    'Declarations 
    '---------------------------------------------------- 
    '. 
    '. 
    '. 
    Dim Item As Repeater = e.Item.FindControl("Files") 

    '---------------------------------------------------- 
    'Output 
    '---------------------------------------------------- 
    '. 
    '. 
    '. 
    With Item 

     Dim FolderID As Int32 = 1 

     '------------------------------------------------ 
     'Data 
     '------------------------------------------------ 
     '. 
     '. 
     '. 
     .DataSource = New PageList(FolderID) 

     '------------------------------------------------ 
     'Bind 
     '------------------------------------------------ 
     '. 
     '. 
     '. 
     .DataBind() 

    End With 

End Sub 
+0

這是一個有趣的評論方法。 –

+0

您是否問如何將FolderID設置爲e.Item值? – Alexander

+0

試過這樣的事情:Dim FolderID As Int32 = DataBinder.GetPropertyValue(e.Item,「FolderID」)沒有運氣 –

回答

1

昏暗FolderID作爲的Int32 = DataBinder.GetPropertyValue(e.Item.DataItem強制轉換, 「FolderID」)