This is a migrated thread and some comments may be shown as answers.

CRUD functionality in GRID Taghelpers

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MVDH
Top achievements
Rank 1
MVDH asked on 17 Mar 2020, 09:15 AM

Problem :

Destroy doesn't go to the controller, What am i doing wrong?

Read function works fine.

Grid :

<kendo-datasource name="dateSource2" type="DataSourceTagHelperType.Ajax" server-operation="false">
        <transport>
            <read url="/Begroting/GetBegrotingWijzigingen?filterElement=2-9" />
            <destroy url="/Begroting/RemoveBegrotingWijziging" />
        </transport>
        <schema>
            <model id="Id">
            </model>
        </schema>
    </kendo-datasource>
 
    <kendo-grid name="grid2" datasource-id="dateSource2">
        <groupable enabled="false" />
        <sortable enabled="true" />
        <scrollable enabled="true" />
        <filterable enabled="true" />
        <pageable button-count="5" refresh="true" page-sizes="new int[] { 5, 10, 20, 50, 100 }">
        </pageable>
        <columns>
            <column field="Datum" title="Datum" />
            <column field="Afdeling" title="Afdeling" />
            <column field="Combinatie" title="Combinatie" />
            <column field="Bedrag" title="Bedrag" />
            <column field="Toelichting" title="Toelichting" />
            <column>
                <commands>
                    <column-command text="Delete" name="destroy"></column-command>
                </commands>
            </column>
        </columns>
    </kendo-grid>

 

Controller :

[HttpPost]
   public IActionResult RemoveBegrotingWijziging([DataSourceRequest] DataSourceRequest request, BegrotingRecord begrotingRecord)
   {
       if (!begrotingRecord.Naarcoda)
       {
           _rW.BegrotingRepository.RemoveBegrotingRecord(begrotingRecord.Id);
       }
 
       return Json("OK");
   }

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetomir
Telerik team
answered on 19 Mar 2020, 01:58 PM

Hi Maxime,

I have investigated the provided code snippets and I have not noticed anything wrong with the declaration. However, what I have noticed is that the editable option is not specified. Is it possible for you to specify it as shown below?

<editable mode="popup" />

The editable option is needed to indicate to the grid that changes could be done to the data source, in this case, items to be deleted.

I hope you find this helps.

 

Regards,
Tsvetomir
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Grid
Asked by
MVDH
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or