This sample demonstrates how to connect a Syncfusion Blazor DataGrid to Microsoft SQL Server through a Web API service. The solution consists of two applications: a Blazor DataGrid client (GridMSSql) and an API service (MyWebService) that communicates with the database. The DataGrid retrieves data and performs CRUD operations through the API layer using the Syncfusion DataManager URL adaptor pattern, providing a practical reference for database-driven Blazor applications.
- Demonstrates data binding between Syncfusion Blazor DataGrid and Microsoft SQL Server through a Web API service.
- Uses a dedicated API project (
MyWebService) to retrieve and update database records. - Supports CRUD operations performed from the Syncfusion Blazor DataGrid.
- Uses the Syncfusion DataManager URL adaptor to communicate with server-side endpoints.
- Uses the
NORTHWND.MDFsample database included in the solution. - Requires database connection configuration through
GridController.cs. - Demonstrates a multi-project architecture separating UI, API, and database access responsibilities.
- Visual Studio 2022 or Visual Studio Code
- .NET SDK compatible with the project's target framework
Visual Studio 2022
- Clone or download this repository.
- Open the solution files contained in the
MyWebServiceandGridMSSqlproject folders. - Restore all NuGet packages.
- Open the Server Explorer in Visual Studio.
- Attach the
NORTHWND.MDFdatabase located in theApp_Datafolder of the service project. - Update the database connection string in
GridController.cs. - Build the solution.
- Start the
MyWebServiceproject first. - Start the
GridMSSqlapplication. - Run the application using
Ctrl+F5.
Visual Studio Code
- Open the repository folder in Visual Studio Code.
- Open the integrated terminal.
- Navigate to the API project directory and restore packages.
cd MyWebService
dotnet restore
dotnet run- Open a second terminal and navigate to the Blazor DataGrid project directory.
cd GridMSSql
dotnet restore
dotnet run- Ensure the API service is running before launching the Blazor application.
- Open the local application URL displayed in the terminal after startup.
GridMSSql/— contains the Syncfusion Blazor DataGrid application that displays records and performs CRUD operations.MyWebService/— contains the API service responsible for database connectivity and data processing.MyWebService/App_Data/— contains theNORTHWND.MDFSQL Server database used by the sample.MyWebService/GridController.cs— contains the database connection string and API endpoints used by the Grid.GridMSSql/Pages/— contains the Blazor pages that render the Syncfusion DataGrid and configure data binding.
- For general product questions, visit the Syncfusion Community Forum or Syncfusion Support.
- To report an issue specific to this sample, open a GitHub issue in this repository.
- For official documentation related to this feature, see https://help.syncfusion.com/grid-sdk/blazor/data-grid/connecting-to-adaptors/url-adaptor
This is a Syncfusion sample project provided to demonstrate product usage. Review the Syncfusion license terms before using Syncfusion components in your own applications.