I\'m passing this ViewModel to my View:
public class DashboardViewModel
{
public List UserTasks {get; set;}
public List
You should store the data you use to loop to a javascript variable and query that when your button is clicked. Keep a unique identifier on your button' data attribute which you can use to query later. Since it is an array, you can simply use a counter variable which matches with the (js) array index.
@{ var counter = 0;}
@foreach (var item in Model.WorkItems)
{
@item.Name
counter++;
}
and in the same razor view, have this javascript where you will serialize the Model.WorkItems
collection to a javascript array and store it in a variable.