Results 1 to 6 of 6

Thread: Dataset, repeater for picture gallery ?

  1. #1

    Thread Starter
    Member Comn8u's Avatar
    Join Date
    Jul 2004
    Posts
    35

    Dataset, repeater for picture gallery ?

    How would you use a repeater within a dataset? I'm trying to display pictures, while only displaying 25 pictures per page. I want to be able to enable paging. How would I do this?
    It's not the size of the dog in the fight, it's the size of the fight in the dog.

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Use a Datalist instead...

    you can set the columns across through a property.

    You can then go a google search for 'DataList paging', you'll get good articles like http://www.dotnetjunkies.com/Tutoria...2516BF05B.dcik


    I mention using DataList because it passes the html validation, whereas Repeaters usually don't.

  3. #3
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    Use a datagrid.

    Bind to query like this

    Code:
    	(
    		@PageSize int,
    		@PageIndex int
    	)
    AS
    	CREATE TABLE #TempTable
    	(
    		ImageRowID int IDENTITY(1,1),
    		ImageKey char(36)
    	)
    	
    	INSERT INTO #TempTable (ImageKey)
    	SELECT Guid FROM Images 
    	
    	SELECT #TempTable.ImageRowID, Images.*
    	FROM #TempTable
    	INNER JOIN Images ON
    	Images.Guid = #TempTable.ImageKey
    	WHERE ImageRowID > @PageSize * @PageIndex
    	AND ImageRowID <= @PageSize * (@PageIndex+1)
    	ORDER BY #TempTable.ImageRowID
    	RETURN
    turn off the detect colums and make it bind to the row and the image name or something. In the On/ItemDataBind event replace the text for column 2 (index 1) clear the text and add an img control with src set to you image load page or the real url if your pics or not in the db

    If that doesn't make since let me know I just woke up
    Magiaus

    If I helped give me some points.

  4. #4
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: Dataset, repeater for picture gallery ?

    Hi!

    I want to add on this question. What if I want to create a simple repeater that renders a table x times y cells filled with images like a photo gallery. I get the image using an ashx http module. How would this be possible?

    I have thought about the idea about creating the itemtemplate with 3 or 4 images, but then I always get the table 3 or 4 cells wide. What if the last image is on cell 1 (from the left). Then I must detect this somehow and remove the images, so they don't show the ugly red cross.

    Anyone has any ideas? I did a google and found very little regarding this. I thought it was a very common problem...

    kind regards
    Henrik

  5. #5
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: Dataset, repeater for picture gallery ?

    Forget my question.... dah, I will just use a DataList control.


    cheers/Henrik

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Dataset, repeater for picture gallery ?

    DataList is best for this purpose. If you have the ListView, that's the same but slightly better and meant for galleries or a dynamic number of cells rather than rows.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width