How do you show x items per row in a repeater?

前端 未结 7 1997
予麋鹿
予麋鹿 2020-12-19 12:49

Anyone have any clue on how to show 4 items going horizontal with a repeater? A repeater shows items going down by default. Here is my test repeater code so far:



        
7条回答
  •  眼角桃花
    2020-12-19 13:22

    This might do the job (I'm assuming you may have more than one row of four images):

    
    
    
    
    <%# (Container.ItemIndex != 0 && Container.ItemIndex % 4 == 0) ? @"" : string.Empty %>
    
    

    <%# (WebMenuItem)Container.DataItem).Name %>

    <%#GetAltText((Item)Container.DataItem) %>

    (no IDE so untested :)

    If it doesn't help, some answers from this question might.

提交回复
热议问题