Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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 February 15th, 2007, 11:37 AM
Authorized User
 
Join Date: Feb 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default set up image size

in Shop/Default.aspx,
there is a hyperlink tag,
              <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl='<%# "ProductDetail.aspx?Id=" + Eval("Id").ToString() %>' ImageUrl='<%# Eval("PictureUrlMedium") %>' ToolTip="Read More..." />


how can i set up a size of an image?

Thanks
Ryan

 
Old February 15th, 2007, 12:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

What do you mean with "set up a size of an image"? Do you just want to add a style attribute for the width? Or do you want to scale the images on the fly?

In the first case, you can't add it to the <asp:Hyoerlink /> as it will be applied to the <a> tag, not the <img> tag. However, you can simply emebed an <asp:Image> within the hyperlink:

<asp:HyperLink runat="server">
  <asp:Image Width="200" runat="Server" />
</asp:HyperLink>

Alternatively, look at chapter 11 - Greeting Cards that deals with resizing images at the server.

Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old February 15th, 2007, 12:31 PM
Authorized User
 
Join Date: Feb 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi Imar,
thank you so much for your quick reply. I have several images with different sizes in PictureUrlMedium column. and when i display them, it doesn't look very nice, that why i want all images display with the same height (height = 100px) for example.

 
Old February 15th, 2007, 01:41 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In that case, you still need to choose between the two methods.

The first (with the image within the <a>) is the quickest solution. However, it also means that the browser scales the image, which may have a negative impact on your image.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old February 15th, 2007, 07:37 PM
Authorized User
 
Join Date: Feb 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, i use your first solution, and it worked. Thanks Imar.

Ryan






Similar Threads
Thread Thread Starter Forum Replies Last Post
set image on <asp:Image> stored in DataBase myself.panku ASP.NET 2.0 Professional 1 August 11th, 2008 10:41 AM
set image size from attribute bonekrusher XSLT 12 August 10th, 2006 05:49 AM
set size of window on load SoC Javascript How-To 3 September 14th, 2004 03:22 AM
how to set the paper size in javascript sundarisekaran J2EE 1 July 15th, 2004 04:42 PM
cin and unlimited data set size phenix151 C++ Programming 4 October 13th, 2003 09:21 AM





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