0 Replies - 3375 Views - Last Post: 15 December 2012 - 04:09 PM Rate Topic: -----

#1 GolDRoger  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 23
  • Joined: 04-August 12

Repeater + Datalist Controls

Posted 15 December 2012 - 04:09 PM

I want to retrieve images from my database and display them in a tile view(4 columns and unlimited rows). I use the repeater control for the rows and the datalist control inside the repeater for the columns.

for an idea of how i want the images to be displayed check out this link : http://www.redbox.com/movies

i tried the repeater with the datalist but it kept repeating the same content for each row so i tried changing the select parameter in the repeaters itemcreated and itemdatabound event but it stopped displaying the content for each event i tried.
 Dim p1 As Integer = Convert.ToInt32(SqlDataSource1.SelectParameters("p1").DefaultValue)
        Dim p2 As Integer = Convert.ToInt32(SqlDataSource1.SelectParameters("p2").DefaultValue)

        p1 = p1 + 4 // minimum range
        p2 = p2 + 3 // maximum range

        SqlDataSource1.SelectParameters("p1").DefaultValue = p1
        SqlDataSource1.SelectParameters("p2").DefaultValue = p2

i added '4' to p1 because i want only 4 columns. The datalist inside the repeater is set initially to display data between 1 and 4. Now after each repetition i want the min range and max range to change like so : 1 and 4, 5 and 8 and so on.
this is the sql select statement and parameters :
SelectCommand="SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY movieID ASC) AS rownumber, [movieID], [movieImageUrl], [movieName], [movieGenre], [movieDescription], [movieStatus] FROM [myMovieRentalDB].[dbo].[movieList]) AS foo WHERE rownumber between (?) and (?)">
            <asp:Parameter DefaultValue="1" Name="p1" Type="String" />
            <asp:Parameter DefaultValue="4" Name="p2" Type="String" />

Please help me out i use Visual Basic and Ms Sql Server 2008..

Is This A Good Question/Topic? 0
  • +

Page 1 of 1