Im new with MVC.
I have a model called UAV.
│Callsign│NumDeliveries│Mileage│MaxVelocity│MinVelocity│
Hawk61 37 96 20 10
BURL14 2047 57 30 15
OTTO93 82 72 25 10
in cshtml file, i made a table only using Callsign, NumDeliveries, Mileage.
<table class="UAV_table" id="UAV_table">
<tr>
<th>Callsign</th>
<th>NumDeliveries</th>
<th>Mileage</th>
</tr>
@foreach (UAV uav in Model.UAVs)
{
<tr onclick="click_row()">
<td onclick="click_row()">
@Html.DisplayFor(modelItem => uav.Callsign)
</td>
<td>
@Html.DisplayFor(modelItem => uav.NumDeliveries)
</td>
<td>
@Html.DisplayFor(modelItem => uav.Mileage)
</td>
</tr>
}
</table>
so the table shows all datas for Callsign, NumDeliveries, Mileage. what i want to do is, when i click the row of the table, i want to see only that correspond information.
@foreach (UAVs uavid in Model.uavs)
{
<p class="detail_title" id="detail_title">
UAV: # (@Html.DisplayFor(modelItem => uavid.MaxVelocity))
</p>
}
for example, using above line of code, if i click first row of that table(callsign = Hawk61), i want to see like UAV: # 20 (MaxVelocity for Hawk61). MaxVelocity is not in the table, so i need to get it from database.
But I have problem with showing data. If i use right above code, it has @foreach statement, it shows all the Hawk61, BURL14, OTTO93's MaxVelocity.
it shows me like
UAV:# 20
UAV:# 30
UAV:# 25
I need to see only what i selected. (just shows what i click, in this example, only need to show UAV:# 20 which is first row, Hawk61's MaxVelocity).
is there any way to get the data from database not using foreach statement? Thank you.
UAV) on the page?UAVpopulated on the server when you pass the collection to the view? (p.s use the 'at' sign to respond to a user)