Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding New Row Restriction in Kendo Grid MVC
    primarykey
    data
    text
    <p>I have a Kendo grid and a Save button on top of the page. When I click on “Add New Record” toolbar, a new row is added in the grid (client side). When I click on save button, I get the updated viewmodel in my controller’s action method which in turns add/update data in the database.</p> <p>Now, I want to restrict adding a row in the grid if the grid has already 5 rows in it which means user will not be able to add a new row if the grid reaches its limit (which is 5 rows). </p> <p>Can anyone of you please give me a sample client side script(jquery) that will restrict user to add new row in the grid?</p> <p>Thank you very much!!!!!!!</p> <p><strong>Index.cshtml</strong></p> <pre><code>@using (Html.BeginForm("Save", "UDF", FormMethod.Post)) { &lt;input class="button" type="submit" name="save" value="Save"/&gt; @(Html.Kendo().Grid(Model.List1) .Name("List1") .HtmlAttributes(new { style = "width:auto;height:100%" }) .ToolBar(toolbar =&gt; toolbar.Create().Text("Add New Record")) .Editable(editable =&gt; editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Top)) .Columns(columns =&gt; { columns.Bound(p =&gt; p.Title) .ClientTemplate("#= Title #" + "&lt;input type='hidden' name='DateFields[#= index(data)#].Title' value='#= Title #' /&gt;") .Title("Title").HtmlAttributes(new { style = "width:30%" }); columns.Bound(p =&gt; p.MaxPrecision).Title("Decimal Places") .ClientTemplate("#= MaxPrecision #" + "&lt;input type='hidden' name='DateFields[#= index(data)#].MaxPrecision' value='#= MaxPrecision #' /&gt;"); columns.Bound(p =&gt; p.IsObsolete).Title("Obsolete") .ClientTemplate("#= IsObsolete #" + "&lt;input type='hidden' name='DateFields[#= index(data)#].IsObsolete' value='#= IsObsolete #' /&gt;"); }) .DataSource(datasource =&gt; datasource .Ajax() .Model(model =&gt; { { model.Id(p =&gt; p.Title); model.Field(p =&gt; p.Title).Editable(true); model.Field(p =&gt; p.MaxPrecision).Editable(true); model.Field(p =&gt; p.IsObsolete).Editable(true); } } ) ) ) } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload