Is it possible to do custom grouping in the ASP.NET ListView control?

前端 未结 3 946
无人共我
无人共我 2021-01-18 06:27

You can only define a GroupItemCount in the ListView, but what if you want to do grouping based on a property of the items in the data source? Sort of an ad-hoc group by. Th

3条回答
  •  别那么骄傲
    2021-01-18 07:09

    Yes Nick gave a great lead. Here's my code-behind

    Dim sCategory_Descr As String
    Function GetGroupHeading(ByVal sGroupName As String) As String
        Dim sReturn As String
        If sCategory_Descr <> sGroupName Then
            sCategory_Descr = sGroupName
            sReturn = "
    Category: " & UCase(sGroupName) & "
    " Else sReturn = "" End If Return sReturn End Function

    And my item_template

                        
        
            
                 
            
                                             
        
             
                                     
                                                           
             
                
                                 
        
    
    

提交回复
热议问题