I am declaring a WebGrid as follows:
@{
WebGrid grid = null;
if (Model.EmailAddressesOfChosenClient.Count<string>() != 0)
{
grid = new WebGrid(Model.EmailAddressesOfChosenClient, ajaxUpdateContainerId: "gridContent");
}
}
Then I am trying to Render the WebGrid as follows without specifying any columns:
<div id="gridContent">
@{ if (grid != null)
{
@grid.GetHtml()
}
}
</div>
My EmailAddressesOfChosenClient property of the Model is IEnumerable of strings where each string is an email address. I would like the WebGrid to contain a single column with title "Email Address" followed by rows of email address strings.
If I render it this way however, my WebGrid shows up with column heading "Length" and the rows contain the length of each email address string.
Why is that? How do I configure things so that I show the email addresses in the rows and with the right column heading? Many thanks