【发布时间】:2014-02-20 17:43:06
【问题描述】:
我在理解如何将事件连接到 ajax.begin 表单时遇到了一些麻烦。
我想要完成的是,我有一个下拉列表,其中包含一个经销商列表。
基于该经销商,我想加载部分视图。我的模型有一个 CurrentReseller 字段,其中包含我需要的所有信息,但我不确定如何根据他们选择的内容更改该值。
现在我知道我可以通过常规 jQuery 做到这一点,但我对 Javascript 或 JQuery 的了解还不够,甚至不知道如何做到这一点。
这是我的 cshtml 页面的内容
@using (Ajax.BeginForm("RenderPartials", "Admin", new AjaxOptions {
UpdateTargetId = "SellerWebSettings",
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
LoadingElementId = "AjaxLoading",
LoadingElementDuration = 500
})) {
Html.Kendo().DropDownListFor(rs => rs.CurrentReseller)
.Name("CurReseller")
.DataTextField("Name")
.DataValueField("Name")
.Events(e => e.Change("OnCurResellerChanged"))//this is event that will ultimately render a new partial, i want this to trigger the "RenderPartials" ajax form.
.DataSource(source => {
source.Read(read => {
read.Action("GetResellers", "Admin");
});
}).OptionLabel("-- Select a Reseller --");
}
<div id="SellerWebSettings"></div>
我如何告诉“更改事件”使用 Ajax.BeginForm() 进行 ajax 表单提交?
【问题讨论】:
标签: jquery asp.net ajax asp.net-mvc kendo-asp.net-mvc