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

How to get message back from Update of ClientDataSource

1 Answer 72 Views
ClientDataSource
This is a migrated thread and some comments may be shown as answers.
Giorgos
Top achievements
Rank 1
Giorgos asked on 26 May 2020, 06:22 AM

I'm using the following ClientDataSource to bind a radgrid. 

<telerik:RadClientDataSource runat="server" ID="clientDataSourceGrid">
    <ClientEvents OnCommand="dataSourceCommand" OnRequestStart="requestStart"  OnRequestEnd="requestEnd"  />
    <DataSource>
        <WebServiceDataSourceSettings>
            <Select Url="../../api/apd" RequestType="Get" />
            <Insert Url="../../api/apd" RequestType="Post" />
            <Update Url="../../api/apd" RequestType="Put" />
            <Delete Url="../../api/apd" RequestType="Delete" />
        </WebServiceDataSourceSettings>
    </DataSource>
    <Schema>
        <Model ID="APDId">
            <telerik:ClientDataSourceModelField FieldName="AM" DataType="String" />

 

The Web API action to do the update is as follows:

 

public void PutAPD(int id, APD apd)
  {
 
        // Do the update ....
 
        // How can I return a message in case something goes wrong in the update?
 
  }

My question is: how can I return a message from PutAPD back to the client? I want to be able to inform the user in case the update failed.

My 

 

                    


1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 28 May 2020, 12:53 PM

Hi ,

 

If you throw an error or return something invalid, most probably you will be able to use the OnRequestFailed event handler for this requirement:
https://docs.telerik.com/devtools/aspnet-ajax/controls/clientdatasource/client-side-programming/events/overview

I hope this will prove helpful.

 

Regards,
Eyup
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
ClientDataSource
Asked by
Giorgos
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or