Scaffolding in ASP.NET MVC Grid control
21 Oct 2021 / 2 minutes to read
Syncfusion provides the Visual Studio Scaffolding for the Syncfusion ASP.NET MVC platform to quickly add code that interacts with data models and reduce the amount of time to develop with data operation in your project. Scaffolding provides an easier way to create Views and Controller action methods for Syncfusion ASP.NET MVC DataGrid controls.
Note: The Syncfusion ASP.NET MVC UI Scaffolder is available from v18.104.22.168.
Add a Scaffolded Item
The following steps direct you to add a Scaffolded item to your ASP.NET MVC Web Application.
- Right-click on Controller folder in the Solution Explorer and select Add → New Scaffolded Item.
- You will see the Add Scaffold dialog. Select Syncfusion ASP.NET MVC UI Scaffolder and click ‘Add’ button, which will display the Syncfusion UI Scaffolding dialog.
- Select the DataGrid control to perform Scaffolding and click Next.
- Syncfusion UI Scaffolding for the selected control dialog will be opened. Enter the Controller and View names as per the application requirement. Also, select the required Model Class of the active project and its relevant Data Context Class and then Click Next.
- Syncfusion UI Scaffolding for the DataGrid control feature dialog will be opened. Select the required features and Click Add. Use the back arrow if you want to modify the already provided Controller or View name, and to change the selected Model Class and Data Context Class.
select the corresponding DataGrid features from option.
- The Controller and the corresponding View files are now generated with the selected features code snippet.
- Ensure at least one Entity Framework model has been exists and the application compiled once.
- If no Entity Framework model exists in your application, refer to the
documentation to generate the Entity Framework model. Once model file added, ensure required DBContext and properties are added. Now, build the application and try scaffolding. If any changes done in model properties later, compile the application once before perform scaffolding.
How to render Syncfusion Control’?’
Refer to the following UG links to render Syncfusion control after performed scaffolding.
Configure Essential JS 2 using Syncfusion.EJ2.MVC4 package
Configure Essential JS 2 using Syncfusion.EJ2.MVC5 package