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
Rowshan Ali
NA
64
143.1k
How to display image from local drive in asp.net C#
Sep 15 2013 1:13 AM
hello dear
i m a new web developer. i need to show image from F drive to website . please anybody help me best regards . my trial in below ......
button_click
{
var st = from s in db.WOs where s.WONo.StartsWith(TextBox1.Text) select s;
MaskedDataList1.DataSource = st;
MaskedDataList1.DataBind();
var st1 = (from s in db.WOs where s.WONo==TextBox1.Text select s).First();
string ff = st1.filesWO;
Response.ContentType = "image/jpeg"; // for JPEG file
string physicalFileName = @"F:\WO\"+ff;//prWO1-1.jpg";
Image img = new Image();
img.ImageUrl = physicalFileName;
//Response.WriteFile(physicalFileName);
}
.........Design.........
<asp:DataList ID="MaskedDataList1" RepeatColumns="2" runat="server"
onitemcommand="MaskedDataList1_ItemCommand"
Width="977px" BackColor="#FFFF66">
<ItemTemplate><br />
<table border="0" cellpadding="0" cellspacing="0" height="110" width="110" align="center"
bgcolor="#F0F8E6">
<tr>
<td width="10" bgcolor="#F0F8E6">
</td>
<td valign="middle" bgcolor="white" height="150" width="150" align="center">
<%# Eval("WONo")%> <%--title='WO/<%# Eval("filesWO") %>'--%>
<a href="javascript:void(0);">
<img src='@F:/WO/<%# Eval("filesWO") %>' align="top" title='@F:/WO/<%# Eval("filesWO") %>' style="border: solid 1px Gray;" height="410" width="400" /> <asp:Button ID="Button1" runat="server" Text='<%#Eval("WONo")%>' />
</a></td>
<br /><td width="10" bgcolor="#F0F8E6">
<br />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
Reply
Answers (
3
)
sending email from c#.net winforms application
How to save current settings - Windows Form applicaiton