Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2010, 01:53 PM
Authorized User
 
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
Default Change record in next image

Hello, i have a FormView connected to a EntityDataSource and i have the following code in my Itemtemplate:
Code:
<asp:ImageButton ID="IMG" runat="server"  ImageUrl='<%# Bind("PictureUrl") %>'/>
<asp:ImageButton ID="Prev" runat="server" onclick="Prev_Click" ImageUrl='<%# Bind("PictureUrl") %>' />
<asp:ImageButton ID="Next" runat="server" onclick="Next_Click" ImageUrl='<%# Bind("PictureUrl") %>' />
I obviously want the previous and next image from my database aswell, how would i do that?

I can think of one way, to make a DataControl and a SourceControl for each image but that sounds very innefficient.

When i tried to change the ImageUrl with vb.net in code behind i got errors about not being able to convert from a [system.string] to system.string.

There is probably a thousand ways (:
 
Old August 25th, 2010, 02:49 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can't you select all three records and use a ListView to display all three of them?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
andreas5 (August 27th, 2010)
 
Old August 25th, 2010, 05:30 PM
Authorized User
 
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
Default

Yes i managed to get 3 different pictures after figuring out the Where property syntax again:)

Now the next problem is that they are all the same size, i wish to have 1 large image and 2 thumbnails. Maybe i should just store Next and Previous PictureId's in a related table.

Thanks
 
Old August 26th, 2010, 04:40 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If you already query three images, than it shouldn't be too hard to give each image its own size, is it? Just leave out the dimensions in the control template.

How does your current SQL statement look? How are you determining what the next and previous images are? And do you use UNION / are you familiar with the UNION construct in SQL? (That's what I would probably use to get the three images).

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
andreas5 (August 27th, 2010)
 
Old August 27th, 2010, 04:31 PM
Authorized User
 
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
Default

I decided to go for 2 controls, one with thumbnails and one with the main image.
Thanks for all your help, i really appreciate it.
 
Old August 28th, 2010, 04:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Many ways to Rome.... ;-)

Glad you found a solution.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
change position of New Record row? Kimber Access VBA 3 June 27th, 2008 07:10 AM
Image Change Continuosly [email protected] PHP How-To 2 January 17th, 2007 09:50 AM
Event on record change needelp Access VBA 5 October 18th, 2006 07:13 PM
Image from record cli PHP How-To 10 May 29th, 2005 04:56 PM
Form change record event ?? Stanny Access 1 December 21st, 2004 12:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.