How do i bind an image to a <asp:Image /> tag in Form View

Posted by Ranhiru on Stack Overflow See other posts from Stack Overflow or by Ranhiru
Published on 2010-03-26T06:14:30Z Indexed on 2010/03/26 6:23 UTC
Read the original article Hit count: 453

Filed under:
|
|
|
|

First i have a getProfileImage.aspx which accepts a CusID and TN as query strings and display n image. So getProfileImage.aspx?CusID=10&TN=Y will show the image fine in the browser :)

But...

Now i am presented with a Form View and i want to bind the src of the image to get the image from the getProfileImage.aspx page...

The following code works fine :) 10 is the customer ID and the image is working fine...

<asp:Image ID="Image1" runat="server" Height="151px" ImageUrl='~/getProfileImage.aspx?CusID=10&TN=N' />

But now i want to Bind the CusID value...

<asp:Image ID="Image1" runat="server" Height="151px" ImageUrl='~/getProfileImage.aspx?CusID=<%# Bind("CusID") %>&TN=N' />

This simply does not work :( The getProfileImage.aspx is called with CusID=<%... where the way i see it the <%# Bind("CusID") %> is not parsed by ASP which would have returned 10...

<%# Bind("CusID") %>

The above tag alone will work... but inserting it to the middle of the tag seems to break it...

Any suggestions ? Thanx a lot in advance :)

© Stack Overflow or respective owner

Related posts about asp

Related posts about c#