Although I have found numerous post regarding this, I still can't seem to get it to work. I am useing some devexpress controls (for reference). I am attempting to pull an image that is stored in SQL 2008 as a varbinary data type. This is my first time contructing
a page like this and I have hit a brick wall. My code is below and I appreciate any help provided!!
ASPX PAGE I am using VB but currently I don't have anything in that code page:
Thanks to those who replied. The answer was pretty simple. DevExpress had a BinaryImage tag that needed to be used. So by replaceing the standard image tag with the <dx:ASPxBinaryImage></dx:ASPxBinaryImage> tag, that solved my problem.
Thanks!!
Jeff
Marked as answer by jthomas8946 on Nov 19, 2012 11:40 AM
jthomas8946
Member
181 Points
240 Posts
SQL varbinary to image in Date View
Nov 17, 2012 12:14 PM|LINK
Although I have found numerous post regarding this, I still can't seem to get it to work. I am useing some devexpress controls (for reference). I am attempting to pull an image that is stored in SQL 2008 as a varbinary data type. This is my first time contructing a page like this and I have hit a brick wall. My code is below and I appreciate any help provided!!
ASPX PAGE I am using VB but currently I don't have anything in that code page:
<dx:ASPxDataView ID="ASPxDataView1" runat="server" Theme="BlackGlass" Width="100%" DataSourceID="SqlDataSource1"> <ItemTemplate> <asp:Label ID="IntIDLabel" runat="server" Text='<%# Eval("IntID") %>' Visible="false" /> <img src="<%# Eval("BinaryData") %>" /> <br/> <asp:Label ID="ViewedFileNameLabel" runat="server" Text='<%# Eval("ViewedFileName") %>' /> <br/> $<asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price") %>' /> </ItemTemplate> </dx:ASPxDataView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="SELECT IntID,FileName,ViewedFileName,DateTimeUploaded ,Type,BinaryData,Category,Price,Active,Description FROM dbo.Drinks " UpdateCommand="UPDATE dbo.Drinks SET ViewedFileName = @ViewedFileName ,Category = @Category ,Price = @Price ,Active = @Active ,Description = @Description WHERE IntID = @IntID" DeleteCommand="Delete From dbo.Drinks Where IntID = @IntID" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"> <DeleteParameters> <asp:Parameter Name="IntID" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="ViewedFileName" /> <asp:Parameter Name="Category" /> <asp:Parameter Name="Price" /> <asp:Parameter Name="Active" /> <asp:Parameter Name="Description" /> <asp:Parameter Name="IntID" /> </UpdateParameters> </asp:SqlDataSource>Frank Jiang ...
All-Star
16006 Points
1728 Posts
Microsoft
Re: SQL varbinary to image in Date View
Nov 19, 2012 04:06 AM|LINK
Different ways to display images in ASPxGridView:
http://devio.wordpress.com/2011/03/27/different-ways-to-display-images-in-aspxgridview/
http://community.devexpress.com/blogs/paulk/archive/2009/11/11/display-an-image-directly-in-an-aspxgridview.aspx
Display images from SQL server database in ASP.Net GridView control:
http://www.aspsnippets.com/Articles/Display-images-from-SQL-Server-Database-in-ASP.Net-GridView-control.aspx
Feedback to us
Develop and promote your apps in Windows Store
vijay_myl
Contributor
5070 Points
1068 Posts
Re: SQL varbinary to image in Date View
Nov 19, 2012 08:22 AM|LINK
hi..
Refer the below link to get and display upload the image form database......
http://www.dotnetcode.in/2011/06/how-to-retrieve-uploaded-images-from.html
My .NET blog
Submit Article
jthomas8946
Member
181 Points
240 Posts
Re: SQL varbinary to image in Date View
Nov 19, 2012 11:40 AM|LINK
Thanks to those who replied. The answer was pretty simple. DevExpress had a BinaryImage tag that needed to be used. So by replaceing the standard image tag with the <dx:ASPxBinaryImage></dx:ASPxBinaryImage> tag, that solved my problem.
Thanks!!