I have a field to my db which is external link and one that is a file. I need to display these fields to my view.
I have this code where I call my data.
@Html.DisplayFor(model => model.announcement_Link)
and for the file
@Html.DisplayFor(model => model.announcement_Uploaded_File)
It brings the url and the file name . How can I make the 1st to be a link and the second to be linked to the file and to be downloaded?
thank you
In Database :
1. For A Link:
eg SQL
:
update AnnouncementTable set announcement_Link='http://www.example.com/Announcement/All'
where ID=123
2. For A Downloadable Link: (Note: saving uploaded file link with filename in column like:)
update AnnouncementTable set announcement_Uploaded_File='http://www.example.com/Announcement/
download/filename' where ID=123
In asp mvc view
1. For A Link:
<a href="@model.announcement_Link">View</a>
2. For A Downloadable Link:
<a href="@model.announcement_Uploaded_File">View</a>
hope this helps.