Wrox Programmer Forums
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics 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 October 6th, 2010, 11:23 AM
Authorized User
 
Join Date: Oct 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Image Control

Hi, A very simple question.

I have a formview which displays an image control.
I want to pass the ImageUrl to it by composing a string in 3 parts: folder location, Id value & extension.

~/images
Eval"(Id")
.jpg

Have to be combined to give this

"~/images/3.jpg"

How do I compose this string 'on the fly' within the formview? My old school asp attempts throw up yellow screens!

regards, Guy

Last edited by guynorton; October 6th, 2010 at 11:26 AM..
 
Old October 6th, 2010, 12:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You can just combine them:

ImageUrl='<%# "SomeStaticPart/" + Eval("Id").ToString() + ".jpg" %>'

For VB, you may need to use & instead of +

Hope this helps,

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!
 
Old October 9th, 2010, 03:03 PM
Authorized User
 
Join Date: Oct 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading Image to Image Control using JavaScript ctranjith General .NET 1 May 28th, 2013 05:43 AM
image and fileupload control bond007 ASP.NET 2.0 Basics 0 April 28th, 2009 12:30 AM
How to get the id of an image control jasdeephere ASP.NET 1.0 and 1.1 Professional 3 January 30th, 2007 09:06 AM
image control paulevision Dreamweaver (all versions) 0 November 18th, 2004 05:45 PM
Image Control edcaru Access 3 June 22nd, 2004 06:41 AM





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