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
Nizam Nizam
NA
11
4.4k
mvc4 how to create download button
Aug 26 2015 12:45 AM
i would like to create a button in my details view .when clicking that button i want to download it from database , i upload it perfectly in my databese
CONTROLLER:
public ActionResult AddDocument(Document document)
{
if (document.UploadDocument != null)
{
using (var ms = new MemoryStream())
{
document.UploadDocument.InputStream.CopyTo(ms);
document.DocumentImage = ms.GetBuffer();
}
}
db.Documents.Add(document);
db.SaveChanges();
ModelState.Clear();
return View();
}
ACTION:
<table class="table table-bordered table-hover document-table">
<thead>
<tr>
<th>SNo</th>
<th class="name">NAME</th>
<th class="description">DESCRIPTION</th>
<th>DOWNLOAD</th>
</tr>
</thead>
@foreach (var item in Model)
{
<tr>
<td>@sn</td>
<td>@Html.DisplayFor(s => item.Name)</td>
<td>@Html.DisplayFor(s => item.Description)</td>
@*<td><button class="btn-info btn download">Download</button></td>*@
@*<td>@Html.ActionLink((s=>item.DocumentImage),"DownloadFile")</td>*@
<td>@Html.ActionLink("Download","DownloadFile")</td>
</tr>
sn++;
}
</table>
Reply
Answers (
1
)
How to access the MAC address of the system?
Print Functionality using thermal Printer