您好我们可以在kendo弹出窗口中放置一个kendo网格吗?我正在尝试打开按钮单击的弹出窗口,并根据按钮单击显示数据库中的数据。
有人可以告诉我如何实现这个目标吗?有没有可用的例子?
由于
答案 0 :(得分:2)
设置窗口弹出窗口
@(Html.Kendo().Window()
.Name("searchWindow")
.Title("Manage Filters")
.Draggable(true)
.Resizable()
.Scrollable(false)
.Width(780)
.Height(500)
.Visible(false)
.Iframe(true)
.Modal(true)
.Events(m=>m.Close("CloseRefresh"))
)
在Click事件
上启动它 $("#btnManageFilters").click(function () {
var window = $("#searchWindow").data("kendoWindow");
window.refresh({
url: "/Order/ListSavedSearches"
});
window.title("Manage Filters");
window.center();
window.open();
});
在部分视图中定义网格并将其返回
public ActionResult ListSavedSearches()
{
OrderGridViewModel ogvm = new OrderGridViewModel();
ogvm = //populate;
return PartialView("_OrderSearchParameters", ogvm);
}
编辑:
如果您发布了一个Form并且它有多个按钮,则需要使用相同的name
进行设置,并将该值作为Controller中的参数。
<input type="submit" id="btnNew" name="command" value="New" />
<input type="submit" id="btnSave" name="command" value="Save" />
<input type="submit" id="btnApply" name="command" value="Apply" />
[HttpPost]
public ActionResult SaveParameters(ViewModel model, string command)
string command
将获得所点击内容的value
。所以如果点击btnSave,那么
命令将等于“保存”根据传入的命令运行switch语句。
如果您的按钮没有发布到表单然后使用JQuery获取值,this.val()
应该在按钮单击事件中工作。并将其传递给上面提到的window.refresh({})
方法中的查询字符串