尝试这个,
在此代码父页面中有一个剑道网格。在该网格显示编辑按钮,用于单击此按钮打开带有控件的弹出窗口。
**This is my button in grid(on click of this button):-**
<a href='javascript: void(0)' onclick='EditItem(this)' name='#=SurveySectionID#' class='k-button k-button-icontext k-grid-edit'><span class='k-icon k-iconSetImagePosition k-edit'></span>Edit</a>
**JS Function:-**
function EditItem(obj) {
var SurveySectionID = obj.name;
OpenKendoWindow({ WindowName: 'windowSection', Url: '@CommonHelper.BaseUrl' + 'Admin/Content/AddEditSection', Data: { SurveySectionID: SurveySectionID, SurveyID: '@Model.SurveyID'} });
}
**This is common function for open kendo window.**
function OpenKendoWindow(para) {
if (para != null) {
var dialog = $("#" + para.WindowName).data("kendoWindow")
dialog.refresh({
url: para.Url,
data: para.Data
});
dialog.open();
CenterWindow(dialog);
return dialog;
}
}
**Below is popup chtml page which is opened by button click event.**
<div class="float_l">
@Html.TextBoxFor(m => m.serviceTypeName, new { id = "txtserviceTypeName", @class = "k-textbox", @maxlength = 48, uifocus = "focus" })
<br />
@Html.ValidationMessageFor(m => m.serviceTypeName)
</div>
<div class="margin_t10 clearfix">
<div class="float_l margin_l20 cols165">
@Html.LabelFor(m => m.LOBId)<span class="color_red">*</span>
</div>
<div class="float_l ">
@(Html.Kendo().ComboBoxFor(model => model.LOBId)
.Name("LOBId")
.Placeholder("--Select--")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(Model.LOBList)
.Events(e => e.Change("ValueChangedOncombo"))
)
<br />
@Html.ValidationMessageFor(m => m.LOBId)
</div>
</div>