Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148846 | Nov 6,2019 10:46 AM UTC | Nov 11,2019 01:37 PM UTC | ASP.NET Core - EJ 2 | 3 |
![]() |
Tags: DataGrid |
<div class=" control-section" id="target">
<ejs-dialog id="alert_dialog" showCloseIcon="true" visible="false" width="750px" target="#target">
<e-content-template>
<ejs-grid id="Grid" dataSource="ViewBag.DataSource" allowPaging="true">
<e-grid-pagesettings pageSize="8"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" validationRules="@(new { required=true, number=true})" width="60"></e-grid-column>
<e-grid-column field="EmployeeID" headerText="Employee ID" validationRules="@(new { required=true})" width="60"></e-grid-column>
<e-grid-column field="ShipCity" headerText="Ship City" width="60"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</e-content-template>
</ejs-dialog>
</div> |
@{
List<object> commands = new List<object>();
commands.Add(new { buttonOption = new { content = "History", cssClass = "e-success", id="historyBtn" } });
}
<ejs-grid id="Grid1" dataSource="@ViewBag.DataSource" allowPaging="true" commandClick="commandClick">
<e-grid-pagesettings pageSize="8"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" validationRules="@(new { required=true, number=true})" width="60"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer Name" validationRules="@(new { required=true})" width="60"></e-grid-column>
<e-grid-column field="Freight" headerText="Freight" validationRules="@(new { required=true})" textAlign="Right" editType="numericedit" format="C2" width="60"></e-grid-column>
<e-grid-column field="ShipCountry" headerText="Ship Country" width="60"></e-grid-column>
<e-grid-column headerText="History" width="120" commands="commands"></e-grid-column>
</e-grid-columns>
</ejs-grid>
<script>
function commandClick(args) {
if (args.commandColumn.buttonOption.id === "historyBtn") {
// Display the dialog
document.getElementById('alert_dialog').ej2_instances[0].show();
}
}
</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.