Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show a field as a Link in ASP.NET MVC
    primarykey
    data
    text
    <p>I am using ASP.NET MVC and following the instructions on tutorial at ASP.NET website "getting-started-with-ef-using-mvc". I have an Equipment Class</p> <pre><code>public class Equipment { [Key] public int EquipID { get; set; } public string EquipName { get; set; } public string EquipDescription { get; set; } public string EquipSerialNumber { get; set; } public string EquipImage { get; set; } public string EquipManufacturor { get; set; } public string EquipLocation { get; set; } public string EquipCalibrationFreq { get; set; } public virtual ICollection&lt;Calibration&gt; Calibrations { get; set; } } </code></pre> <p>and each Equipment class has one or more <strong>Calibration</strong> records. Below is my Calibration class.</p> <pre><code> public class Calibration { [Key] public int RecID { get; set; } public int EquipID { get; set; } public DateTime CalibrationDate { get; set; } public decimal? CalibrationCost { get; set; } public String CalibratedBy { get; set; } public String CalibrationCert { get; set; } public DateTime NextCalibrationDue { get; set; } public String ResponsibleSection { get; set; } public virtual Equipment Equipment { get; set; } } </code></pre> <p>Now on my Index page for Equipment I am showing related Calibration records (Master-Details). Have a look below: <img src="https://i.stack.imgur.com/kJEkW.jpg" alt="enter image description here"> So in the column [Calibration Certificate] instead path to document, I want to show a Link to document, which shall open the document either in browser or in associated program.</p> <p>This is the markup for that child calibration records</p> <pre><code> @foreach (var item in Model.Calibrations) { &lt;tr&gt; &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.CalibrationDate)&lt;/td&gt; &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.CalibratedBy) &lt;/td&gt; &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.CalibrationCost)&lt;/td&gt; &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.NextCalibrationDue)&lt;/td&gt; &lt;td&gt;@Html.DisplayFor(modelItem =&gt; item.CalibrationCert) &lt;/td&gt; </code></pre> <p> } Please help me how can I make this a Link to document and the LinkTitle should show the documentName.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload