|
-
Aug 3rd, 2004, 05:55 AM
#1
Thread Starter
Fanatic Member
datagrid
Hi,
In a datagrid on the web form using C#, I would like to have a column which retrieves a picture based on the GetImage function that I have created and then I would like this to be a hyperlink so that when you click it it uses the value of the first column.
This is what I have using itemtemplate. It retrieves the image but I do not know how to make this image into a hyperlink.
Thanks
<asp:TemplateColumn HeaderText="US">
<ItemTemplate>
<asp:Image Runat="server" ImageUrl='<%# GetImage(DataBinder.Eval(Container,"DataItem.Status").ToString()) %>'></asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
-
Aug 3rd, 2004, 06:07 AM
#2
You should just be able to wrap the asp:Image tag in an asp:Hyperlink tag.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Aug 3rd, 2004, 06:13 AM
#3
Thread Starter
Fanatic Member
Hi,
I tried what you suggested as below and the error is:
Parser Error: Type 'System.Web.UI.WebControls.HyperLinkColumn' does not have a property named 'asp:Image'.
May be what I did is incorrect. Please see below:
<asp:HyperLinkColumn Text="view" DataNavigateUrlField="ImportDate" DataNavigateUrlFormatString="statusSearch.aspx?ImportDate={0}" HeaderText="Details">
<asp:Image Runat="server" ImageUrl='<%# GetImage(DataBinder.Eval(Container,"DataItem.Status").ToString()) %>' ID="Image1"></asp:Image>
</asp:HyperLinkColumn>
-
Aug 3rd, 2004, 06:18 AM
#4
Not HyperlinkColumn, Hyperlink. 
I don't know offhand if Hyperlink is the exact type name for the tag, but you should be able to see it in the toolbox.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Aug 3rd, 2004, 07:39 AM
#5
or you could use an imagebutton for the column setting it's image as above and then you could set it's commandArgument to the value of the first column and then redirect in code using response.redirect depending on the value of the commandArg.
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
|