473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

DataImageUrlField

Expand|Select|Wrap|Line Numbers
  1. <asp:ImageField DataImageUrlField="picname" DataImageUrlFormatString="http://bytes.com/images/{0}">
will retreive an image from the folder '~/images/' using the value in 'picname' (eg. 'abc.jpg') The image is therefore '~/images/abc.jpg'

How does one use TWO placeholders? That is, if the image 'abc.jpg' is saved in the folder '~/images/dfs/' (for the client 'dfs'), using the database fields 'picname' and 'client', what is the DataImageUrlField's value? (The image is now '~/images/dfs/abc.jpg')

Thanks
Jan 11 '09 #1
3 7507
liawcv
33
Many methods. One of them:

1. Convert the ImageField to TemplateField, so that you can write your own databinding expression.

2. Then, in the source view, change the Image's ImageUrl field to:

Expand|Select|Wrap|Line Numbers
  1. <asp:Image ID="Image1" runat="server"
  2.    ImageUrl='<%# string.Format("~/Images/{0}/{1}", Eval("client"), Eval("picname")) %>'
  3.    AlternateText="Anything" />
  4.  
Jan 11 '09 #2
liawcv
33
Another method: Alter your SQL to return a custom field with values from both of your client field and picname field. E.g.

Expand|Select|Wrap|Line Numbers
  1. SELECT field1, field2, ..., (client + '/' + picname) AS ImageUrl
  2. FROM table1
  3.  
Thus, you can make use of the custom ImageUrl in your ImageField. E.g.

Expand|Select|Wrap|Line Numbers
  1. <asp:ImageField DataImageUrlField="ImageUrl
  2.    DataImageUrlFormatString="~/images/{0}">
  3.  
Jan 11 '09 #3
Cheers mate! saved me a hassle trying it from the wizard
Jan 11 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: yefei | last post by:
I need to display images in a SQL database using a gridview I search some examples, what they did is very simple add an image field, then set the folowing properties <asp:imagefield...
3
by: velu | last post by:
Asp.Net 2 I am trying to display Image from Northwind Database. I ran a queary "SELECT CategoryID, CategoryName, Description, Picture FROM Categories" but the Dataview displayes all the fields...
0
by: manmit.walia | last post by:
Hello All, Basically What I did is create a gridview with 7 columns. One of the columns is the LinkButton that binds it's text value to a column in my dataset. The rest of the columns are pretty...
3
by: | last post by:
I'm using the DataList and GridView controls, and I am trying to wrap my head around the problem of conditionally showing or hiding cells/cell content based on the presence or absence of DB data. I...
0
by: SLeininger | last post by:
I get a red X when I try to import my BLOB images out of SQL server. I only have two fields 'PersonIdNo' is the key and 'Photo' is the BLOB images (jpg). Here is my page so far: <%@ Page...
1
by: The Colonel | last post by:
I'm using an ImageField in a GridView with the DataImageUrlField set to a URL on the 'Net. The images are not displaying (the URL is correct - I can copy and paste in the browser, they come right...
0
by: kbutterly | last post by:
Good morning all, I have a product database in which I store some images. I have created a showThumbnail.aspx page to display the thumbnail image. This page has no code on it, just the Page...
1
by: imranabdulaziz | last post by:
Dear All, I am using asp.net2.0, sql 2005 I am storing Image url in database. through that url i would like to show images in gridview I want to know is it possible to show images in gridview. ...
3
by: anjali5 | last post by:
Hello Everyone, I want to display an image in my gridview. The only thing is my datatabse table is returning true if there is an image and false if there is no image and I am binding my...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.