Hyperlink/Image Control (Full Version)

All Forums >> [Web Development] >> Expression Web Help



Message


swoosh -> Hyperlink/Image Control (5/12/2008 21:47:31)

Hi All,

Have a database results page showing a few fields for each record including an image from the database.

These images are not thumbnails but rather simply resized (I know I know) using the height and width property. The control used is a simple Image Control which allows for the resizing.

However, when using this, I cannot make it a hyperlink to the details page of the property because the image control does not have a NavigateURL property to customize.

Now if I use a Hyperlink control instead of an image control I can have the image as a hyperlink BUT CANNOT RESIZE THE IMAGE BECAUSE THE HYPERLINK CONTROL DOES NOT HAVE A HEIGHT AND WIDTH PROPERTY.

So my question is: How does one have the image come in from the database (which can be resized) and also use it as a hyperlink to the details page.

Thanks a bunch for at least reading and would appreciate any ideas




jaybee -> RE: Hyperlink/Image Control (5/13/2008 5:44:38)

quote:

page
Scuse me if I'm totally confuzzled here but whatever code you're using to produce the image from that database ends up writing

<img src="blah blah blah" width="nn" height="nn" /> to the page? If so, wrap that in
<a href="URL" alt="img desc" title="where we going?"> existing img src here </a>
The URL could also be pulled from the database.

If all images are resized the same then you could use CSS to do it

.imagesized {height:50px; width:90px;}

<img class="imagesized" src="...........




swoosh -> RE: Hyperlink/Image Control (5/13/2008 7:48:27)

Jaybee,
I thank you for your assistance. I'm figuring that's how to do it but I need to know how to do it in ASP.NET......I can use the Hyperlink Control & also make it a link but no resize option. Just wondered if anyone knew how to put the image control inside of the ASP Hyperlink Template Control




rdouglass -> RE: Hyperlink/Image Control (5/13/2008 8:43:44)

quote:

image control inside of the ASP Hyperlink Template Control


Its actually quite similar. You put it inside like this:

<asp:HyperLink runat="server" ID="hyperSponsor" Target="_blank" >
<asp:Image runat="server" ID="imgSponsor" AlternateText="Click here to visit our sponsor's site." />
</asp:HyperLink>


Then you control the asp:Image tag as normal.

Is that what you're looking for?




swoosh -> RE: Hyperlink/Image Control (5/13/2008 8:54:13)

Yes Roger I believe that's it.......but am I correct in stating that I would have to use the NavigateURL property for the hyperlink control AND the ImageURL property for the Image control>




rdouglass -> RE: Hyperlink/Image Control (5/13/2008 10:56:12)

Yes, you are correct.

Are you using a codebehind page? I do something like this (using the link example I posted above) in ASP.NET:

...
imgSponsor.ImageUrl = myImagePathAndName
hyperSponsor.NavigateUrl = imgDisplayCompany1.ImageUrl
...

That help any?





swoosh -> RE: Hyperlink/Image Control (5/14/2008 19:17:35)

Roger and Jaybee,

Thanks so much for your assistance. It now works thanks to you guys.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
6.298828E-02