Skip to content

Commit acfc795

Browse files
committed
Update the sample
1 parent 0bf3a2e commit acfc795

4 files changed

Lines changed: 60 additions & 33 deletions

File tree

Cascading-dropdown-remote-data/filter_core/filter_core/Controllers/HomeController.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,30 @@ public IActionResult Index()
2121
ViewBag.DataSource = Order;
2222

2323
return View();
24-
}
24+
}
2525

26-
27-
public IActionResult StateDataSource([FromBody]ExtendedDataManager dm)
28-
{
26+
public IActionResult StateDataSource([FromBody] ExtendedDataManager dm)
27+
{
28+
var states = States.getStates();
2929

30-
var state = States.getStates();
31-
32-
var Data = state.ToList();
33-
int count = state.Count();
30+
int countryId = 0;
3431

32+
if (dm.Where != null && dm.Where.Count > 0)
33+
{
34+
var jsonValue = (JsonElement)dm.Where[0].value;
3535

36-
List<States> iterateState= new List<States>();
37-
foreach (States st in state) {
38-
if (st.countryId == (Int64)dm.Where[0].value) {
39-
iterateState.Add(st);
40-
}
41-
}
42-
return dm.RequiresCounts ? Json(new { result = Data.Skip(dm.Skip).Take(dm.Take), count = count }) : Json(iterateState.ToList());
36+
if (jsonValue.ValueKind == JsonValueKind.Number)
37+
{
38+
countryId = jsonValue.GetInt32(); // or GetInt64()
4339
}
40+
}
4441

42+
var filteredStates = states
43+
.Where(st => st.countryId == countryId)
44+
.ToList();
45+
46+
return Json(filteredStates);
47+
}
4548
public IActionResult CountryDataSource([FromBody]ExtendedDataManager dm)
4649
{
4750

Cascading-dropdown-remote-data/filter_core/filter_core/Views/Shared/_Layout.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>@ViewData["Title"] - filter_core</title>
77
@* Syncfusion Essential JS 2 Styles *@
8-
<link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/material.css" />
8+
<link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/33.1.44/material3.css" />
99

1010
@* Syncfusion Essential JS 2 Scripts *@
1111
<script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js"></script>
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
9-
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="17.3.0.14" />
8+
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="33.1.44" />
109
</ItemGroup>
1110

12-
<ItemGroup>
13-
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
14-
</ItemGroup>
15-
16-
</Project>
11+
</Project>

README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,43 @@
1-
# ASP.MET CORE DataGrid - Cascading Dropdown Remote Data Editing in Data Binding
1+
# EJ2-Grid-Core-dotnet3-databinding-remote
22

3-
This sample explains about how to achieve the cascading dropdown with remote data-binding in the ASP.NET Core DataGrid inline editing.
3+
## Repository Description
4+
5+
This repository contains an ASP.NET Core 3 sample application that demonstrates rendering the EJ2 DataGrid component with remote data binding. The project focuses on server-side data integration and grid rendering using the Syncfusion EJ2 library.
6+
7+
## Project Overview
8+
9+
The application illustrates the usage of the EJ2 Grid within a .NET Core 3 framework. Data is retrieved from a remote source and bound to the grid at runtime. The sample highlights the interaction between the controller and the client-side grid component, making it suitable for understanding remote data scenarios in enterprise web applications.
10+
11+
## Features
12+
13+
- EJ2 Grid integration with ASP.NET Core 3
14+
- Remote data binding through server endpoints
15+
- Initial grid rendering with server-provided data
16+
- Minimal and clean configuration setup
417

518
## Prerequisites
619

7-
* Visual Studio 2022
20+
- .NET Core SDK 3.x
21+
- Visual Studio 2019 or later
22+
- Basic understanding of ASP.NET Core MVC
23+
- EJ2 dependencies referenced in the project
24+
25+
## Installation
26+
27+
1. Clone the repository to the local system.
28+
```
29+
git clone <repo_link>
30+
```
31+
2. Open the solution file in Visual Studio.
32+
3. Restore NuGet packages to resolve required dependencies.
33+
4. Run the application.
34+
35+
36+
## Usage
837
9-
## How to run the project
38+
When the application starts, the grid requests data from the configured server endpoint. The response is processed and displayed within the EJ2 Grid component.
1039
11-
* Checkout this project to a location in your disk.
12-
* Open the solution file using the Visual Studio 2022.
13-
* Restore the NuGet packages by rebuilding the solution.
14-
* Run the project.
40+
## Reference Documentation
41+
42+
- [Getting started with ASP.NET CORE Grid](https://ej2.syncfusion.com/aspnetcore/documentation/grid/getting-started-core)
43+
- [Remote Data Binding](https://ej2.syncfusion.com/aspnetcore/documentation/grid/data-binding/remote-data)

0 commit comments

Comments
 (0)