Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148075 | Oct 3,2019 10:01 AM UTC | Oct 10,2019 04:11 AM UTC | ASP.NET Core - EJ 2 | 5 |
![]() |
Tags: DataGrid |
[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>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.