I'm passing this ViewModel to my View:
public class DashboardViewModel
{
public List<UserTask> UserTasks {get; set;}
public List<WorkItem> WorkItems {get; set;}
}
and from within the View I'm iterating through the WorkItems like this:
@foreach (var item in Model.WorkItems)
{
@item.Name
@item.HoursLogged
<button value="@item">UPDATE</button>
}
When I click on the button a jQuery function is opening up a modal.
I need to pass to the modal the item in order to display all the item infos.
This is the javascript function:
$(buttonEl).click(function () {
//code to open modal
var item = this.value;
});
The value passed in "this.value" is not an object but a string with the namespace of the WorkItem.
I have also tried with inline onclick function:
<button onclick="openModal('@item')">UPDATE</button>
but with the same result.
Any idea?