Let me start by saying this: I have looked at multiple answers, and I can't just seem to wrap my head around it - it may be that I'm just brainfarted. But here goes my question:
My question is specifically regarding the dropdownlist: With the hardcoded values: today, month, year.
Whenever I select something in the dropdownlist, I want to post/submit the value, for example "today" to the controller. How do I do this?
Thanks for your time.
@using (Html.BeginForm("DisplayDetails", "Client"))
{
@*Start of searchBox*@
<div id="searchBox">
Enter client e-mail: <input id="txtUser" type="text" name="clientID" /> <input id="btnFind" type="submit" />
</div>
@*<--- End of searchBox --->*@
if (Model != null)
{
@*Start of infobox and wrapper*@
<div id="infoBoxWrapper">
<div class="infoBox">
<fieldset>
<legend style="padding: 0.2em 0.5em; border: 1px solid black; font-size: large;"> Client info </legend>
<table>
<tr>
<td> <b> First name: </b></td>
<td>
@Html.DisplayFor(m => m.FName)
</td>
</tr>
<tr>
<td> <b> Last name: </b></td>
<td> @Html.DisplayFor(m => m.LName) </td>
</tr>
<tr>
<td> <b> Phone: </b></td>
<td> @Html.DisplayFor(m => m.Phone)</td>
</tr>
<tr>
<td> <b> E-mail: </b></td>
<td> @Html.DisplayFor(m => m.UserID) </td>
</tr>
</table>
</fieldset>
</div>
@*<--- End of infobox --->*@
@*Start of recordsBox*@
<div id="recordsBox">
<fieldset>
<legend style="padding: 0.2em 0.5em; border: 1px solid black; font-size: large;"> Records </legend>
<table>
<tr>
<td> <b>Time</b></td>
<td> <b>Systolic</b> </td>
<td> <b>Diastolic</b> </td>
<td> <b>Pulse</b> </td>
</tr>
@for (int i = 0; i < Model.Records.Count; i++)
{
string style = null;
if (Model.Records[i].Score == 1) { style = "background-color:green"; }
else if (Model.Records[i].Score == 2) { style = "background-color:blue"; }
else if (Model.Records[i].Score == 3) { style = "background-color:yellow"; }
else if (Model.Records[i].Score == 4) { style = "background-color:orange"; }
else if (Model.Records[i].Score == 5) { style = "background-color:red"; }
<tr style="@style">
<td>
@Model.Records[i].Time
</td>
<td>
@Html.DisplayFor(m => m.Records[i].Systolic)
</td>
<td>
@Html.DisplayFor(m => m.Records[i].Diastolic)
</td>
<td>
@Html.DisplayFor(m => m.Records[i].Pulse)
</td>
</tr>
}
</table>
</fieldset>
</div>
</div>
@*<--- End of infobox wrapper --->*@
@*Start of chartbox*@
<div id="chartWrapper">
<div id="comboBox">
<select id="dpChoice">
<option value="today">Today</option>
<option value="month">This month</option>
<option value="year">This year</option>
</select>
</div>
<div id="chartbox">
@Model.Chart
</div>
</div>
@*<--- End of chartbox --->*@
}
else
{
<label> Search for a client...</label>
}
}