Skip to content
This repository was archived by the owner on May 30, 2025. It is now read-only.
Hasmukh Patel edited this page Jan 29, 2016 · 2 revisions

Knockout Web Controls Extensions for MVC 4 and above

Welcome to the MVCControlsExtensions wiki! MVC 4 Controls Extensions contains extension methods for standard html & Knockout controls like editable generic Grid, dropdown, textbox, radiobutton & checkbox controls.

To install MVC 4 Controls Extensions, run the following command in the Package Manager Console PM>Install-Package MVCControlsExtensions source code available at Github

Controls Extensions @Html.KOTextBoxFor(model => model.Name)

@Html.KODisplayFor(model => model.Name)

@Html.KOCheckBoxFor(x=>x.IsActive)

@Html.KODateTextBoxFor(model => model.Date)

@Html.KODropDownListFor(model => model.Id, Model.SelectedList)

@Html.KOPasswordFor(model => model.Password)

@Html.KOForeEachBindingFor(model => model.Items)

@Html.KOPartialFor(model => model.Address,"_address")

Grid Example Editable KO grid

@Html.KOGridFor(model => model.NewsList, col => col.AddKOTextColumnFor(item => item.Summary, options: new KOBindingOptions { Enable = "canEdit()" }), col => col.AddKOTextColumnFor(item => item.Description), col => col.AddKODateTextColumnFor(item => item.PublishedOn), col => col.AddKOTextColumnFor(item => item.Id), col => col.AddColumn("X", ""), col => col.AddKODeleteButtonColumn("X", "Add", options: new KOBindingOptions { Click = "$parent.removeNews" }, headerOptions: new KOBindingOptions { Click = "$data.addNews" })) @Html.ValidationMessageFor(model => model.NewsList)
Vertical Editable Grid
@Html.VerticalGridFor(x => x.NewsList, col => col.AddColumnFor(x => x.Description), col => col.AddColumnFor(x => x.PublishedOn), col => col.AddColumnFor(x => x.Summary))

Clone this wiki locally