Problem in displaying Image in DataView..

W

Winista

Isn't Picture column in NW database "Binary" type field? You first need to
get the binary blob from DB, store it as image file on disk and then specify
the URL. Or you need to stream the binary data through a control as image
stream into the response.
 
G

Guest

Asp.Net 2

I am trying to display Image from Northwind Database.

I ran a queary "SELECT CategoryID, CategoryName, Description, Picture FROM
Categories" but the Dataview displayes all the fields except Picture.

so i add a Imagefield to display images..but now i get cross icon..

below is the code. correct me where i am wrong....

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="CategoryID"
DataMember="DefaultView" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="CategoryID"
HeaderText="CategoryID" InsertVisible="False"
ReadOnly="True" SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName"
HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:BoundField DataField="Description"
HeaderText="Description" SortExpression="Description" />
<asp:ImageField DataAlternateTextField="Picture"
DataImageUrlField="Picture" DataImageUrlFormatString="~\Images\{0}.jpg"
HeaderImageUrl="Picture" HeaderText="Picture"
ReadOnly="True">
</asp:ImageField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT CategoryID, CategoryName, Description,
Picture FROM Categories">
</asp:SqlDataSource>
 
G

Guest

i appericate your quick respond.

i am sorrry i am very basic in asp.net. i wonder how i would convert the
blob stuff..

is there any other way to display an image frm DB ?
 
Joined
Jul 11, 2007
Messages
1
Reaction score
0
You can try the complete stand alone server control "SpiceLogic BLOB & FILE Control for ASP.NET",
here is the link : http://www.spicelogic.com/showProducts.aspx?productID=ASPNETBLOBnFILEControl

This control will allow you to show the BLOB data directly from your SQL without writing any extra code or ASHX handler files etc... simply bind the byte[] BlobData property of this control with the VarBinary field and you will be all set. Moreover, you can also upload image directly to the BLOB using this control by setting UploadMode=true and place this control in the Edit Item template of the GridView control. You can also show Thumbnails and lots of more features... very useful...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top