RadGrid Calling ClientDataSource 3 times per request

3 posts, 0 answers
  1. Jason
    Jason avatar
    29 posts
    Member since:
    Aug 2009

    Posted 09 Nov 2018 Link to this post

    I'm hoping this is a silly error

    this is the markup

    <telerik:RadClientDataSource ID="ClaimsDataSource" runat="server" EnableServerPaging="true" EnableServerSorting="true" AllowPaging="true"  >
        <DataSource>                              
            <WebServiceDataSourceSettings BaseUrl="http://localhost:39338/" >
                <Select Url="ui/list/claims" RequestType="Get" DataType="JSON" EnableCaching="true"  />
            </WebServiceDataSourceSettings>
        </DataSource>           
        <Schema DataName="Data">
            <Model>
                <telerik:ClientDataSourceModelField FieldName="DateofLoss" DataType="Date" />
            </Model>
        </Schema>
    </telerik:RadClientDataSource>
     
    <telerik:RadGrid ID="grdCLaims" runat="server" ClientDataSourceID="ClaimsDataSource" AllowPaging="true" PageSize="2" AllowSorting="true"  >
        <MasterTableView ClientDataKeyNames="ClaimItemID" DataKeyNames="ClaimItemID">
            <Columns>                       
                <telerik:GridBoundColumn DataField="PolicyNumber" HeaderText="Policy Number" />
                <telerik:GridBoundColumn DataField="ClientName" HeaderText="Client" />
                <telerik:GridBoundColumn DataField="DateofLoss" HeaderText="Date of Loss" DataFormatString="{0:dd MMM yyyy}" />
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="true" />           
            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
        </ClientSettings>
    </telerik:RadGrid>

     

    this is the JSON that the service is returning

    {
       "Data":[
          {
             "ClientName":"Ethan McWindsor",
             "PolicyNumber":"PUMA100558",
             "DateofLoss":"2015-12-09T00:00:00",
             "ClaimItemID":256,
          },
          {
             "ClientName":"Ethan McWindsor",
             "PolicyNumber":"PUMA100558",
             "DateofLoss":"2016-11-25T00:00:00",
             "ClaimItemID":413,
          }
       ],
       "Count":2
    }

    no matter what i do, the service is getting called three times on the in initial page load

    from the network log in chrome

    http://localhost:39338/ui/list/claims?take=2&skip=0&page=1&pageSize=2
     
    http://localhost:39338/ui/list/claims?take=2&skip=0&page=1&pageSize=2
     
    http://localhost:39338/ui/list/claims?take=10&skip=0&page=1&pageSize=10

     

    (there is nothing in the code-behind)

    any ideas?

  2. Jason
    Jason avatar
    29 posts
    Member since:
    Aug 2009

    Posted 09 Nov 2018 in reply to Jason Link to this post

    fixed it by adding PageSize="2" to the RadClientDataSource.

  3. Attila Antal
    Admin
    Attila Antal avatar
    320 posts

    Posted 13 Nov 2018 Link to this post

    Hi Jason,

    The described behavior is a known issue which is logged in our System and can be accessed in our Feedback Portal at Grid with RadClientDataSource sends two requests when navigating with Grid pager.

    Alternatively to the solution you have found, you may also check out the following Code Library: Retrieve filtered data from RadClientDataSource using RadGrid's event. This may also be a viable workaround for the reported issue.

    Kind regards,
    Attila Antal
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top