How to Put the image from SQL to page in c#
up vote
1
down vote
favorite
I use this at my class
public byte Picture { get; set; }
And this to my view but
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<span alt="image" class="img-lg" >@item.Picture</span>
<div class="col-sm-4">
</div>
</div>
}
but to the image section in the web it doesn't show the image but it only show this
System.Byte
How can i fix this ?
i even try this but its the same
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<img alt="image" class="img-lg" src="@item.Picture">
<div class="col-sm-4">
</div>
</div>
}
c#
add a comment |
up vote
1
down vote
favorite
I use this at my class
public byte Picture { get; set; }
And this to my view but
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<span alt="image" class="img-lg" >@item.Picture</span>
<div class="col-sm-4">
</div>
</div>
}
but to the image section in the web it doesn't show the image but it only show this
System.Byte
How can i fix this ?
i even try this but its the same
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<img alt="image" class="img-lg" src="@item.Picture">
<div class="col-sm-4">
</div>
</div>
}
c#
1
Did you see this?
– Peter Schneider
Nov 8 at 13:25
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I use this at my class
public byte Picture { get; set; }
And this to my view but
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<span alt="image" class="img-lg" >@item.Picture</span>
<div class="col-sm-4">
</div>
</div>
}
but to the image section in the web it doesn't show the image but it only show this
System.Byte
How can i fix this ?
i even try this but its the same
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<img alt="image" class="img-lg" src="@item.Picture">
<div class="col-sm-4">
</div>
</div>
}
c#
I use this at my class
public byte Picture { get; set; }
And this to my view but
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<span alt="image" class="img-lg" >@item.Picture</span>
<div class="col-sm-4">
</div>
</div>
}
but to the image section in the web it doesn't show the image but it only show this
System.Byte
How can i fix this ?
i even try this but its the same
@foreach (var item in Model.EmployeeCollection)
{
<div class="row">
<div class="col-sm-1">
<img alt="image" class="img-lg" src="@item.Picture">
<div class="col-sm-4">
</div>
</div>
}
c#
c#
edited Nov 8 at 13:33
D-Shih
23.9k61331
23.9k61331
asked Nov 8 at 13:21
E.Lahu
135
135
1
Did you see this?
– Peter Schneider
Nov 8 at 13:25
add a comment |
1
Did you see this?
– Peter Schneider
Nov 8 at 13:25
1
1
Did you see this?
– Peter Schneider
Nov 8 at 13:25
Did you see this?
– Peter Schneider
Nov 8 at 13:25
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
This can be done easily with Convert.ToBase64String()
string Image = "data:Image/png;base64," + Convert.ToBase64String(bytes);
Then used like this
<img scr="@Image">
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
This can be done easily with Convert.ToBase64String()
string Image = "data:Image/png;base64," + Convert.ToBase64String(bytes);
Then used like this
<img scr="@Image">
add a comment |
up vote
2
down vote
accepted
This can be done easily with Convert.ToBase64String()
string Image = "data:Image/png;base64," + Convert.ToBase64String(bytes);
Then used like this
<img scr="@Image">
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
This can be done easily with Convert.ToBase64String()
string Image = "data:Image/png;base64," + Convert.ToBase64String(bytes);
Then used like this
<img scr="@Image">
This can be done easily with Convert.ToBase64String()
string Image = "data:Image/png;base64," + Convert.ToBase64String(bytes);
Then used like this
<img scr="@Image">
answered Nov 8 at 13:27
Patte
548218
548218
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208619%2fhow-to-put-the-image-from-sql-to-page-in-c-sharp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Did you see this?
– Peter Schneider
Nov 8 at 13:25