I'm using the MVC Grid to allow users to search for items and add them to a BOM. The grid currently has three columns, ItemNumber, Description, and a column with a ClientTemplate that calls an Action method and passes it the ItemNumber.
I need to add a column that has an empty/unbound textbox that only accepts numbers so they can enter a quantity value that will also get passed to the Action method along with the ItemNumber.
Am I going about this the best way? Is there a better way? How can I add a numeric only textbox and capture the value entered and pass it to an Action method along with the ItemNumber?
My grid is defined as:
@(Html.Kendo().Grid<
AFLExternal.Models.afl_vw_OTS_Items
>()
.Name("OTSItemGrid")
.Columns(columns =>
{
columns.Bound(c => c.ITEMNMBR).Width(50).Title("")
.ClientTemplate(
"<
a
href='" +
Url.Action("AddItem", "OTSBOM") +
"?id=#= ITEMNMBR #'" +
"
class
=
'btn btn-success'
>#= ITEMNMBR #</
a
>"
);
columns.Bound(c => c.ITEMDESC).Title("Desc").Width(174).HtmlAttributes(new { style = "font-size: 12px;" });
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.AutoSync(false)
.Batch(true)
.Model(m =>
{
m.Field(p => p.ITEMNMBR).Editable(false);
m.Field(p => p.ITEMDESC).Editable(false);
})
.Read(read => read.Action("OTSItem_Read", "OTSBOM"))
.ServerOperation(true)
.Events(events => events.Error("error_handler"))
)
.ToolBar(toolBar =>
{
toolBar.Search();
})
.Height(400)
.Sortable()
.Navigatable()
.Search(srch =>
{
srch.Field(f => f.ITEMNMBR);
srch.Field(f => f.ITEMDESC);
})
)