Get values from model in select element to assign to Request.Form[]
I need to store both the name and the id of the option the user chooses in my SQL Database. Right now I am only storing the Id, by setting the value of the option to the current Id of the iteration.
@foreach (var item in selection)
{
if (item.Id.ToString() == contentId)
{
//dont mind this, just for displaying purposes
}
else
{
<option value="@item.Id" @(Request.Form["førstePrio"] != null && Request.Form["førstePrio"].ToString().Equals(item.Name.ToString()) ? " selected" : "")>@item.Name</option>
}
}
I don't have a surface controller associated with the view, since I am doing my SQL connection and commands in the view.
How can I store the @item.Name value as well in a separate Request.Form to be saved in the database?
Get values from model in select element to assign to Request.Form[]
I need to store both the name and the id of the option the user chooses in my SQL Database. Right now I am only storing the Id, by setting the value of the option to the current Id of the iteration.
I don't have a surface controller associated with the view, since I am doing my SQL connection and commands in the view.
How can I store the @item.Name value as well in a separate Request.Form to be saved in the database?
is working on a reply...