or
<
div
id
=
"cboSearchStringValidate1"
>
<
input
type
=
"search"
id
=
"cboSearchString1AC"
/>
<
input
id
=
"cboSearchString1DDL"
/>
</
div
>
$(
"#btnSearch"
).click(
function
() {
alert(
'start to validate'
);
$(
"#cboSearchStringValidate1"
).kendoValidator({
rules: {
customruleSearchStrings1:
function
(input) {
if
(cboSearchString1AC.length == 0 && $(cboSearchString1DDL).val ==
""
){
return
input.val() === "true"
;
}
return
true
;
}
},
messages: {
customruleSearchStrings1:
"Search must not be empty"
}
});
alert(
'validate checked'
);
}
);
var validator1 = $("#cboSearchStringValidate1").kendoValidator().data("kendoValidator");
if (!validator1.validate()) {
alert("validated search strings 1");
alert('yes, we are valid');
}
else {
alert("no such luck");
}
create: function (e) {
//custom createfunction with callback
vm.CourseFactory.Insert(e.data, function success(data) {
e.success(data);
});
},
update: function (e) {
//custom update function with callback
vm.CourseFactory.Update(e.data, function success(data) {
e.success(data);
});
},
@Html.Kendo().DropDownListFor(x => x.TrainList).BindTo(Model.TrainList).HtmlAttributes(new { style = "width:150px" }).DataTextField("CNX_AUT").DataValueField("Id").Name("trainList").Value("Id").Text("CNX_AUT")
@Html.Kendo().NumericTextBoxFor(x => x.BeltScaleWeight).Name("beltScaleWeight").HtmlAttributes(new { style = "width:150px" })
<
button
class
=
"k-button"
id
=
"applyToCars"
style
=
"width:150px"
>Apply To Cars</
button
>
<
div
id
=
"GridWindow"
>
<
br
/>
<
br
/>
@(Html.Kendo().Grid<
CNX.Domain.Entities.EDIRailcar
>()
.Name("RailCarGrid")
.Columns(columns =>
{
columns.Bound(o => o.Id).Visible(false);
columns.Bound(o => o.EDI_417_TRAIN_GUID).Visible(false);
columns.Bound(o => o.EQUIPMENT_INITIAL);
columns.Bound(o => o.EQUIPMENT_NUMBER);
columns.Bound(o => o.WEIGHT);
columns.Bound(o => o.TARE_WEIGHT);
columns.Bound(o => o.AS_RECEIVED_WEIGHT);
columns.Bound(o => o.Pile);
columns.Bound(o => o.Class);
columns.Bound(o => o.STATUS);
})
.DataSource(dataSource => dataSource.Ajax()
.PageSize(10)
.Read(read => read.Action("ApplyWeights", "MenuWeight")
.Type(HttpVerbs.Post))
.Model(model => model.Id(o => o.Id)))
.Pageable()
.Sortable()
.Filterable()
)
</
div
>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
var win = $("#GridWindow").kendoWindow({
actions: ["Maximize", "Minimize", "Close"],
draggable: true,
height: "500px",
width: "500px",
modal: true,
resizable: true,
visible: false,
position: { top: 100, left: 100 }
}).data("kendoWindow");
});
$("#applyToCars").click(function () {
var selectedTrain = $("#trainList").data("kendoDropDownList");
var weightValue = $("#beltScaleWeight").data("kendoNumericTextBox");
var win = $("#GridWindow").data("kendoWindow");
var grid = $("#RailCarGrid").data("kendoGrid");
/*How do i pass the values they selected to the controller? */
grid.dataSource.fetch();
win.title('Railcar weights for ' + selectedTrain.text() );
win.center();
win.open();
});
</
script
>