我正在使用 ASP.NET MVC 架构。我在单击按钮时有一个 Telerik 窗口,效果很好。代码如下 -
<% Html.Telerik().Window()
.Name("Search")
.Visible(false)
.Title("Select Users")
.Content(() => {%>
<% using (Html.BeginForm("GetUsers", "Administration", FormMethod.Post,
new{id ="users-form"}))
{%>
<p class="note">Mention the Users name to display information</p>
<label for="username">Name:</label>
<%= Html.TextBox("username") %>
<div class="form-actions">
<button type="button" class="bUsername">Search</button>
</div>
<% } %>
<%})
.Width(400)
.Modal(true)
.Render();%>
但是当我尝试在 Telerik 窗口的内容中添加 Telerik 网格时,它给了我错误..代码如下
<%= Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(o => o.OrderID).Width(100);
columns.Bound(o => o.ContactName).Width(200);
columns.Bound(o => o.ShipAddress);
columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120);
})
.DataBinding(dataBinding =>
{
dataBinding.Server().Select("FirstLook", "Grid", new { ajax =
ViewData["ajax"] });
dataBinding.Ajax().Select("_FirstLook",
"Grid").Enabled((bool)ViewData["ajax"]);
})
.Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
.Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
.Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
.Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
.Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
.Footer((bool)ViewData["showFooter"])
%>
错误:.Content(() => {%> ----Delegate System.Func 不接受 0 个参数。
所以想问一下我们能否在模态窗口中有网格,如果是,那么如何实现它,如果我们不能,还有什么替代方法?