I am trying to create a webgrid that will have rows of one column. The number of rows will depend upon the number of email addresses (strings) in the Model coming in. Here's the code of the view:
@model BarClients.Models.BarClientsViewModel
@{
var grid = new WebGrid(Model.EmailAddressesOfChosenClient, ajaxUpdateContainerId: "gridContent");
int rowIndex = 0;
if (Model.EmailAddressesOfChosenClient != null)
{
foreach (var email in Model.EmailAddressesOfChosenClient)
{
grid.Rows.Add(new WebGridRow(grid, email, rowIndex++));
}
}
}
div id="gridContent"
@grid.GetHtml()
/div (arrows removed).
At @grid.GetHtml(), I am getting the error: A data source must be bound before this operation can be performed.
Is it even possible what I am trying to do? Many thanks.