For the image, you will need an <img> element with a src attribute (this will need to pass an ID) and that will make a different HTTP request. This means you then need something on the server to accept that request and load the image based upon the ID and
render it as binary. Just search for "ASP.NET image" to find an example.
Not that I want to hijack the thread with yet another "why don't you instead", but I thought that Blobs were something that we were trying to get rid of and instead the recommendation was to use filesystem documents?
Not that I want to hijack the thread with yet another "why don't you instead", but I thought that Blobs were something that we were trying to get rid of and instead the recommendation was to use filesystem documents?
Yea, agreed -- but I think he's just doing sample code since he's on the northwind DB. But yes, this is a good point -- not recommened to store images/blobs in the DB if you can avoid it.
amitabha_joy
Member
4 Points
8 Posts
Image binding with webgrid from database
May 04, 2012 09:02 AM|LINK
I am using northwind database for backend.Table is category.I want to display all categories in webgrid with image.I am using mvc razor.
How to do?Plz help me.
Category Table Structure
CategoryID int PK,
CategoryName varchar
Description varchar
Picture image
BrockAllen
All-Star
28052 Points
4996 Posts
MVP
Re: Image binding with webgrid from database
May 04, 2012 12:54 PM|LINK
For the image, you will need an <img> element with a src attribute (this will need to pass an ID) and that will make a different HTTP request. This means you then need something on the server to accept that request and load the image based upon the ID and render it as binary. Just search for "ASP.NET image" to find an example.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
Nicolas V
Member
111 Points
49 Posts
Re: Image binding with webgrid from database
May 04, 2012 05:25 PM|LINK
Not that I want to hijack the thread with yet another "why don't you instead", but I thought that Blobs were something that we were trying to get rid of and instead the recommendation was to use filesystem documents?
BrockAllen
All-Star
28052 Points
4996 Posts
MVP
Re: Image binding with webgrid from database
May 04, 2012 06:04 PM|LINK
Yea, agreed -- but I think he's just doing sample code since he's on the northwind DB. But yes, this is a good point -- not recommened to store images/blobs in the DB if you can avoid it.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
amitabha_joy
Member
4 Points
8 Posts
Re: Image binding with webgrid from database
May 08, 2012 06:23 AM|LINK
Could u plz give me an example with source code in asp.net mvc 3 with webgrid?I know how to do with asp.net but I am new to asp.net mvc 3 .
amitabha_joy
Member
4 Points
8 Posts
Re: Image binding with webgrid from database
May 08, 2012 06:25 AM|LINK
Could u plz give me an complete example with source code using asp.net mvc 3 ,razor view and sql server database
BrockAllen
All-Star
28052 Points
4996 Posts
MVP
Re: Image binding with webgrid from database
May 08, 2012 02:54 PM|LINK
Search for MVC and FileResult -- this is one I found that seems decent.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/