User591932912 posted
@model IEnumerable<FamilyTreeMvc.Models.FAMILY>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<h3>Select Person</h3>
<h3> @Html.DropDownList("PERSONID", null, htmlAttributes: new { @class = "form-control" })</h3>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.PERSONID)
</th>
<th>
@Html.DisplayNameFor(model => model.PERSON.IMAGE)
</th>
<th>
@Html.DisplayNameFor(model => model.FAMILYRELATION.RELATIONDESC)
</th>
<th>
@Html.DisplayNameFor(model => model.PERSON.FIRSTNAME)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
if (@item.PERSONID ==6)//Instead of static value i want to get selected value from the dropdown list
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.PERSONID)
</td>
<td>
<img src="@Url.Content("~/Images/" + (@item.PERSON.IMAGE))" style="height:100px;width:100px" />
</td>
<td>
@Html.DisplayFor(modelItem => item.FAMILYRELATION.RELATIONDESC)
</td>
<td>
@Html.DisplayFor(modelItem => item.PERSON.FIRSTNAME)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.RID }) |
@Html.ActionLink("Details", "Details", new { id = item.RID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.RID })
</td>
</tr>
}
}
</table>
@model IEnumerable @{ ViewBag.Title = "Index"; }
Index
@Html.ActionLink("Create New", "Create")
Select Person
@Html.DropDownList("PERSONID", null, htmlAttributes: new { @class = "form-control" })
@foreach (var item in Model) { if (@item.PERSONID ==6) //Here I want to get drop downlist selected value instead of giving static value {} }
@Html.DisplayNameFor(model => model.PERSONID) |
@Html.DisplayNameFor(model => model.PERSON.IMAGE) |
@Html.DisplayNameFor(model => model.FAMILYRELATION.RELATIONDESC) |
@Html.DisplayNameFor(model => model.PERSON.FIRSTNAME) |
|
@Html.DisplayFor(modelItem => item.PERSONID) |
 |
@Html.DisplayFor(modelItem => item.FAMILYRELATION.RELATIONDESC) |
@Html.DisplayFor(modelItem => item.PERSON.FIRSTNAME) |
@Html.ActionLink("Edit", "Edit", new { id = item.RID }) | @Html.ActionLink("Details", "Details", new { id = item.RID }) | @Html.ActionLink("Delete", "Delete", new { id = item.RID }) |