[Index.cshtml]
<ejs-grid id="Grid" dataSource="ViewBag.dataSource" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" allowPaging="true">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" newRowPosition="Top"></e-grid-editSettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" validationRules="@(new { required=true, number=true})" width="140"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer Name" validationRules="@(new { required=true, maxLength=5})" width="150"></e-grid-column>
----
</e-grid-columns>
</ejs-grid>
|
Index.cshtml
<ejs-grid id="Grid" allowPaging="true" load="onLoad" actionComplete="ActionComplete" toolbar="@(new List<string>() {"Add", "Edit", "Update", "Delete" })">
...
<script>
function ActionComplete(args) {
if (args.requestType == "beginEdit") {
var inputElement = document.getElementById(this.element.id + "CustomerID");
inputElement.setAttribute('maxlength', '5');
}
}
</script>
|