How to add a Grid to my MVC

2 posts, 0 answers
  1. David
    David avatar
    26 posts
    Member since:
    Oct 2019

    Posted 24 Jan 2020 Link to this post

    I have a CRUD MVC app that is working with no problem. My new project is to add the Telerik grid and batch editing. Well, when I go to add the items, I notice I can straight add the controller as a Telerik form with a grid already made. I thought, wonderful! Now I'm wondering how do I add my links to it that edit and update and details. Do I add the links on the Grid views page? Or do I need to make a separate controller for it? Or do I need to just make a MVC read/write form and add the grid by code? 


    I'm a C# developer, and I'm not educated well in Json/Ajax/Java so please bear with me. 

  2. Petar
    Petar avatar
    502 posts

    Posted 28 Jan 2020 Link to this post

    Hi David,

    You need to add a separate controller for each of the CRUD operations.

    Please check this Batch editing demo. When you scroll down the page to the example's source code. You will see this DataSource definition:

    .DataSource(dataSource => dataSource        
            .Events(events => events.Error("error_handler"))
            .Model(model => model.Id(p => p.ProductID))
            .Create("Editing_Create", "Grid")
            .Read("Editing_Read", "Grid")
            .Update("Editing_Update", "Grid")
            .Destroy("Editing_Destroy", "Grid")

    The marked in yellow lines in the above snippet show us how we define the controllers for each CRUD operation. If you click on the EditingController.cs tab in the linked above Batch editing demo page, you will see the definitions of the different controllers used.

    Progress Telerik

    Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
Back to Top