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
Bineeshcp Viswanath
NA
140
39.4k
How to Display Image from Database in Modal Popup
Mar 30 2019 7:07 AM
Hello All,
I need your help to display image from database in modal popup window in asp.net application.
I have mentioned my code for your reference.
Here my htm code:-
<
div
class
=
"modal fade"
id
=
"myModal"
>
<
div
class
=
" modal-dialog modal-dialog-centered"
>
<
div
class
=
"modal-content"
>
<
div
class
=
"modal-header"
>
<
h4
class
=
"modal-title"
>
Image Details
</
h4
>
</
div
>
<
div
class
=
" modal-body"
>
<
img
class
=
"img-rounded"
id
=
"modal_Img"
src
=
'<%# Eval("Image")%>'
style
=
"width: 100%"
runat
=
"server"
/>
<
br
/>
<
asp:TextBox
ID
=
"tbxComment"
CssClass
=
"text-primary"
Width
=
"350px"
TextMode
=
"MultiLine"
runat
=
"server"
>
</
asp:TextBox
>
</
div
>
<
div
class
=
"modal-footer"
>
<
button
type
=
"button"
class
=
"btn btn-primary"
data-dismiss
=
"modal"
>
Save
</
button
>
<
button
type
=
"button"
class
=
"btn btn-secondary"
data-dismiss
=
"modal"
>
Close
</
button
>
</
div
>
</
div
>
</
div
>
</
div
>
And below is the c# code:-
private
void
LoadImageBasedOnFID(Int64 FID)
{
try
{
using
(SqlCommand command =
new
SqlCommand(
"LoadImageBasedOnFID"
, clsConObj.sqlCon))
{
clsConObj.OpenConnection();
command.Parameters.Add(
"@FID"
, SqlDbType.SmallInt).Value = FID;
command.CommandType = CommandType.StoredProcedure;
using
(SqlDataReader reader = command.ExecuteReader())
{
while
(reader.Read())
{
modal_Img.Src = reader[
"Image"
].ToString();
ClientScript.RegisterStartupScript(
this
.GetType(),
"Pop"
,
"openModal();"
,
true
);
}
}
clsConObj.CloseConnection();
}
}
catch
(Exception ex)
{
}
}
Reply
Answers (
1
)
how to pass a token in WCF API
using page handle