|
[index.cshtml]
@model filter_core.Models.data;
@using Syncfusion.EJ2;
<form asp-controller="Home" asp-action="Index" method="post">
<div class="row mt-2">
<div class="col-sm-6 col-lg-6 col-md-6">
<ejs-combobox id="ToolID" name="ToolID" dataSource="@Model.Tools" value="@Model.ToolID" placeholder="Tool ID" floatLabelType="Always" width="200">
<e-combobox-fields value="ToolID"></e-combobox-fields>
</ejs-combobox>
</div>
</div>
<div class="row mt-2">
<div class="col-sm-6 col-lg-6 col-md-6">
<div id="submitbutton">
<ejs-button id="submitButton" content="Submit"></ejs-button>
</div>
</div>
</div>
</form>
<div class="container">
<ejs-grid id="Grid" dataSource="@Model.orderData" ---->
-------
</ejs-grid>
</div> |
|
[Home.controller.cs]
public ActionResult Index(int ToolID) // use input field id with proper datatype (int) to retrieve data
{
// do your action
data data = new data();
List<OrderDetail> orderData;
if (ToolID > 0)
{
orderData = data.GetAllRecords().Where(item => item.EmployeeID == ToolID).ToList();
data.ToolID = ToolID;
}
else
{
orderData = data.GetAllRecords();
}
data.orderData = orderData;
data.Tools = data.GetAllRecordsTools();
return View(data);
} |
|
[index.cshtml]
@model filter_core.Models.data;
@using Syncfusion.EJ2;
<form id="formtoupdategrid" asp-controller="Home" asp-action="Index" method="post">
<div class="row mt-2">
<div class="col-sm-6 col-lg-6 col-md-6">
<ejs-combobox id="ToolID" name="ToolID" dataSource="@Model.Tools" value="@Model.ToolID" placeholder="Tool ID" floatLabelType="Always" width="200" change="comboBoxChange">
<e-combobox-fields value="ToolID"></e-combobox-fields>
</ejs-combobox>
</div>
</div>
</form>
<div class="container">
<ejs-grid id="Grid" dataSource="@Model.orderData" ---->
-----
</ejs-grid>
</div>
<script>
function comboBoxChange(args) {
// get the form element
var form = document.getElementById('formtoupdategrid');
// submit the form
form.submit();
}
</script>
|