How to get message back from Update of ClientDataSource

2 posts, 0 answers
  1. Giorgos
    Giorgos avatar
    25 posts
    Member since:
    Apr 2013

    Posted 26 May 2020 Link to this post

    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 

     

                        


  2. Eyup
    Admin
    Eyup avatar
    4046 posts

    Posted 28 May 2020 Link to this post

    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.
Back to Top