view image from database to asp page [Resolved]

Posted by Bshan under ASP.NET on 7/16/2012 | Points: 10 | Views : 2481 | Status : [Member] | Replies : 7
Hi,
I am try to view an image from database. I used handler and invoke it by following code..

<asp:GridView ID="gvImage" runat="server" AutoGenerateColumns="false">
<columns>
<asp:TemplateField >
<ItemTemplate>
<asp:Image ID="Image2" runat="server" ImageUrl='<%# "ShowImage.ashx?StudentID=" + Eval("StudentID") %>' AlternateText="N/A" />
</ItemTemplate>
</asp:TemplateField>
</columns>
</asp:GridView>

But it not working. The error flashes is.....
Conversion from string "ShowImage.ashx?StudentID=" to type 'Double' is not valid.




Responses

Posted by: Patel28rajendra on: 7/18/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi

If you got the Answer please Mark it as Answer

R D Patel

Bshan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 7/16/2012 [Member] Starter | Points: 25

Up
0
Down
@Bshan
Can u post wat u wrote code in cs

Thanks & Regards
Hari

Bshan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 7/16/2012 [Member] Starter | Points: 25
Posted by: GSM_GSV on: 7/17/2012 [Member] Starter | Points: 25

Up
0
Down
You can store your images in a folder with ID as 1, 2, 3 etc which will be PK of your database. If you store your image in DB, it will be stored as binary. So, conversion problems may occur.
What I mentioned is just another way. You can do it by storing your image in database also

---------------------------------------
Live the life you've dreamed

Regards
MADHU

Bshan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bshan on: 7/17/2012 [Member] Starter | Points: 25

Up
0
Down
Its work and thank for you support......

Bshan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/17/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Refer this url
it will help u

http://www.codeproject.com/Articles/33310/C-Save-and-Load-Image-from-Database

.

Bshan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response