...

View Full Version : Displaying Images



Max01
02-21-2007, 09:20 PM
Hi guys,

For most thisíll appear trivial, however for me, itís taking up a lot of frustrating and misdirected time. Very briefly, Iím building a number of web forms to facilitate the collection of personal data. Once collected, the contents of the database can be filtered etc., in order to display an individualís details in much the same fashion as a CV. My problem is that Iím unable to display an image per individual. The text details are being pulled in via the Ď<%# Eval("blablabla") %>í method.

Iím new to ASP.NET and have recently read Stephen Waltherís similarly entitled book; unfortunately he doesnít really address this topic. Any advice on how I can display an image within an individualís profile?

Thanks in advance for any response.

Max01

nikkiH
02-21-2007, 09:51 PM
Are you using .net 2.0 personalization features, or is this something you rolled on your own and are just storing in the database?

Max01
02-21-2007, 10:41 PM
Hello,

Thanks for replying. In answer to your question, no, I'm not using .net 2.0 personalization features; it's something I'm attempting to roll out my own. I'm sure it's a really trivial mistake.

nikkiH
02-22-2007, 04:10 PM
Okay, so you said you want to display an image per individual, and you already have text in a database associated with a person.
Which part are you unsure how to do?
Do you already have images for people?
Are you storing those images but unsure how to get them back? Are they stored as files, or as blobs in the database?
Are they user uploaded images, or chosen from a set of images you already have?

At the most basic, a user would upload an image and you would store the path to that image in the database. You could then get that path and output it as just a plain old image tag with a dynamic source using your eval syntax.

Max01
02-22-2007, 04:43 PM
Hi,

Thanks once more for responding.

Your last paragraph has nailed the problem; a user uploads details including image from which I must sort into an orderly document so as to make it viewable to third parties. I'm saving the path in the following fashion:

<asp:ImageField
DataImageUrlField="FileName"
DataImageUrlFormatString="~/Photos/{0}"
DataAlternateTextField="AltText" >
<ControlStyle Width="300px" />
</asp:ImageField>

but, this only works in GridView, and moreover, you can only alter the image size to the detriment of its resolution. I want display each Id's details on a seperate page, not in GridView. Also, <ImageField> is a GridView specific property. Any advice?

Thanks in advance.

Max01

nikkiH
02-22-2007, 09:11 PM
I'm not totally clear on your architecture, so bear with me.
Do you have a database row that has all this information, including the image path, in it? And you now want to display it all on one page for a given person?

If so, simple query and use Repeater, DetailsView, or ListView and use ItemTemplate to display all pretty and formatted as you desire.
You can use ImageField or just the Image control.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.image.aspx

Max01
02-23-2007, 01:35 PM
Thank you Nikki, I'll give it a go.

Max01



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum