or
@model ServiceUserViewModel<
BR
>@{<
BR
> ViewBag.Title = "New User";<
BR
>}<
BR
><
BR
>@using (Html.BeginForm())<
BR
>{<
BR
> @Html.AntiForgeryToken()<
BR
> @Html.ValidationSummary(true)<
BR
> <
fieldset
><
BR
> <
legend
>Registration Form</
legend
><
BR
> <
table
><
BR
> <
tr
><
BR
> <
td
class
=
"editor-label"
><
BR
> @Html.LabelFor(m => m.UserName)<
BR
> </
td
><
BR
> <
td
class
=
"editor-field"
><
BR
> @Html.EditorFor(m => m.UserName)<
BR
> @Html.ValidationMessageFor(m => m.UserName)<
BR
> </
td
><
BR
> </
tr
><
BR
> <
tr
><
BR
> <
td
class
=
"editor-label"
><
BR
> @Html.LabelFor(m => m.Password)<
BR
> </
td
><
BR
> <
td
class
=
"editor-field"
><
BR
> @Html.PasswordFor(m => m.Password)<
BR
> @Html.ValidationMessageFor(m => m.Password)<
BR
> </
td
><
BR
> </
tr
><
BR
> <
tr
><
BR
> <
td
class
=
"editor-label"
><
BR
> @Html.LabelFor(m => m.ConfirmPassword)<
BR
> </
td
><
BR
> <
td
class
=
"editor-field k-password"
><
BR
> @Html.PasswordFor(m => m.ConfirmPassword)<
BR
> @Html.ValidationMessageFor(m => m.ConfirmPassword)<
BR
> </
td
><
BR
> </
tr
><
BR
> <
tr
><
BR
> <
td
class
=
"editor-label"
><
BR
> @Html.LabelFor(m => m.FirstName)<
BR
> </
td
><
BR
> <
td
class
=
"editor-field"
><
BR
> @Html.EditorFor(m => m.FirstName)<
BR
> @Html.ValidationMessageFor(m => m.FirstName)<
BR
> </
td
><
BR
> </
tr
><
BR
> <
tr
><
BR
> <
td
class
=
"editor-label"
><
BR
> @Html.LabelFor(m => m.LastName)<
BR
> </
td
><
BR
> <
td
class
=
"editor-field"
><
BR
> @Html.EditorFor(m => m.LastName)<
BR
> @Html.ValidationMessageFor(m => m.LastName)<
BR
> </
td
><
BR
> </
tr
><
BR
> <
tr
><
BR
> <
td
class
=
"editor-label"
><
BR
> @Html.LabelFor(m => m.Colour)<
BR
> </
td
><
BR
> <
td
class
=
"editor-field"
><
BR
> @(Html.Kendo().ColorPicker()<
BR
> .Name("colourPicker")<
BR
> .Palette(ColorPickerPalette.WebSafe)<
BR
> //.Value(Model.Colour)<
BR
> .Events(events => events<
BR
> .Change("pickerSelect")<
BR
> )<
BR
> )<
BR
><
BR
> @Html.HiddenFor(m => m.Colour)<
BR
> @Html.ValidationMessageFor(m => m.Colour)<
BR
> </
td
><
BR
> </
tr
><
BR
> </
table
><
BR
> </
fieldset
><
BR
>}<
BR
><
BR
>@section Scripts {<
BR
> @Scripts.Render("~/bundles/jqueryval")<
BR
>}
@(Html.Kendo().Grid<
ServiceUserViewModel
>()<
BR
> .Name("ServiceUsersGrid")<
BR
> .AutoBind(true)<
BR
> .Columns(columns =><
BR
> {<
BR
> columns.Bound(p => p.ServiceUserId).Hidden();<
BR
> columns.Bound(p => p.FirstName).Title("First Name");<
BR
> columns.Bound(p => p.LastName).Title("Last Name");<
BR
> columns.Command(command => command.Edit().UpdateText("Save")).Hidden();<
BR
> columns.Command(command => command.Destroy()).Width(100);<
BR
> })<
BR
> .ToolBar(toolbar => <
BR
> {<
BR
> toolbar.Create().Text("Add User");<
BR
> })<
BR
> .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("NewPerson"))<
BR
> .Sortable(sortable => sortable<
BR
> .AllowUnsort(true)<
BR
> .SortMode(GridSortMode.MultipleColumn))<
BR
> .Scrollable()<
BR
> .Events(e=>e.Edit("RenameNewUserWindow").DataBound("onDataBound").Change("onDataBound"))<
BR
> .DataSource(dataSource => dataSource<
BR
> .Ajax()<
BR
> .ServerOperation(false)<
BR
> .Events(events => events.Error("error_handler"))<
BR
> .Model(model =><
BR
> {<
BR
> model.Id(p => p.Id);<
BR
> model.Field(f => f.FirstName);<
BR
> model.Field(f => f.LastName);<
BR
> model.Field(f => f.Password);<
BR
> model.Field(f => f.ConfirmPassword);<
BR
> model.Field(f => f.Colour);<
BR
> })<
BR
> .Read(read => read.Action("ServiceUser_Read", "Services"))<
BR
> .Create(create => create.Action("ServiceUser_Create", "Services"))<
BR
> .Update(update => update.Action("ServiceUser_Create", "Services"))<
BR
> .Destroy(destroy => destroy.Action("ServiceUser_Destroy", "Services"))<
BR
> )
function
pickerSelect(e) {<BR> $(
"#Colour"
).val(e.value);<BR>}
@(Html.Kendo().Grid<
SearchViewModel
>()
.Name("searchGrid")
.Columns(columns =>
{
columns.Bound(x => x.ProductId);
columns.Bound(x => x.ProductName);
})
.AutoBind(false)
.DataSource(ds => ds
.Ajax()
.Read(read => read.Action("Search", "Product").Data("getSearchCriteria"))
)
)
)
function getSearchCriteria() {
var product = $("#ProductName").data("kendoAutoComplete").value();
var productType = $("#ProductType").data("kendoDropDownList").select();
if (product || productType) {
return { ProductName: product, ProductType: productType };
} else {
// TODO: Figure out how to cancel this request.
alert("You must provide at least one search parameter.");
return false;
}
}