TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Cleiton Limas
NA
7
548
Return a blob image error
Jan 4 2018 8:04 PM
Hello guys,
I created a controller and a view, to fetch data from my database an image, which is in blob format. However, the image is not loaded in the view (I call a method to call this view).
I have the controller Image (with the GetImage method), the ReadyDrive controller and the ReadyDelivery view. Within the ReadyDate view, I pass the parameter to get the ID in the GetImage method.
Controller Imagem:
public
ActionResult Index()
{
return
View();
}
public
ActionResult GetImagem(
int
id)
{
Entities1 tabela =
new
Entities1();
byte
[] BlobImg = tabela.DATABINARY.Where(p => p.ID.Equals(id)).Select(p => p.DATA).FirstOrDefault();
return
File(BlobImg,
"image/png"
);
}
Controller ProntaEntrega
public
ActionResult Index(
int
? reduzido=
null
)
{
Entities1 Estoque =
new
Entities1();
List<V500_ESTOQUE_PE_WEB> ProntaE = (from a
in
Estoque.V500_ESTOQUE_PE_WEB select a).OrderByDescending(x => x.TOTAL_KG_PE).ToList()
.Where(x => reduzido !=
null
? x.COD_REDUZIDO.Equals(reduzido) :
true
).ToList();
return
View(ProntaE);
}
View ProntaEntrega (a piece of that):
<tbody>
@
foreach
(var item
in
Model)
{
<tr>
<td
class
=
"text-left"
width=
"30%"
>
@Html.DisplayFor(d => item.COD_REDUZIDO)
</td>
<td
class
=
"text-left"
>
@Html.DisplayFor(d => item.DESC_ARTIGO)
</td>
<td
class
=
"text-right"
>
@Html.DisplayFor(d => item.TOTAL_KG_PE)
</td>
<td>
<img src=
"@Url.Action("
GetImage
", "
Imagem
", new { id = @item.IDBLOB})"
width=50 />
</td>
</tr>
}
</tbody>
But the images do not load on view.
Any help me?
Thanks!
Reply
Answers (
2
)
Role Based Access Control(RBAC) in ASP.NET MVC
How to add line below the header text in pdf document in C#