|
-
Apr 29th, 2006, 09:58 AM
#1
Thread Starter
Hyperactive Member
Datagrid and Images
Anyone have an easy method for inserting a picture (based on a product number) into a datagrid column. I assume it needs to be a templet with an image control set in the input frame. But can this string be built in a data class and databind it?
gollnick
-
Apr 30th, 2006, 03:29 AM
#2
Hyperactive Member
Re: Datagrid and Images
yes, when you insert the asp:Image control to your template click on "Data Bindings", once youve done that choose the column of your class that the file name is associated to. in the box below that is the format string box. that is where you put something like "/images/{0}". that will bind your file name to the {0} part and will show up on the page.
If this post helps, please RATE MY POST!
Using Visual Studio 2005 SE
-
Apr 30th, 2006, 06:00 AM
#3
Thread Starter
Hyperactive Member
Re: Datagrid and Images
Thanks. Do you mean select the ImageUrl .. Then Container and inside that the DataItem .. then in the format .... "/images/{0}" ???
Would you have an example ??
Thanks .. gollnick
-
Apr 30th, 2006, 12:19 PM
#4
Hyperactive Member
Re: Datagrid and Images
yes, it would be in the ImageUrl part of the <asp:Image> tag.
it would look something like this:
<asp:Image runat="server" ID="Img1" ImageUrl="<%# Bind("ImageLocation", "/images/{0}") %>">
that would be inside your <itemTemplate> tag for that column of the gridview.
If this post helps, please RATE MY POST!
Using Visual Studio 2005 SE
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|