Мне нужны разные записи, но у меня есть ошибка:
Столбец "данные" не существует.
Server Error in '/' Application.
Column "data" does not exist.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Column "data" does not exist.
Source Error:
Line 14: var grid = new WebGrid(ViewBag.dat ,null, "Dates", 8);
Line 15: }
Line 16: @grid.GetHtml(
Line 17: tableStyle: "grid",
Line 18: headerStyle: "head",
Мой контроллер:
var d = (from b in baza.hours
where b.userID == userID
select new { b.data.Month }).Distinct();
ViewBag.dat = d;
И мой взгляд:
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
@{
var grid = new WebGrid(ViewBag.dat ,null, "Dates", 8);
}
@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("data","Dates")
)
)
</fieldset>
}
Как это исправить?