Client Side Binding - Overriding POST

3 posts, 1 answers
  1. Jorge
    Jorge avatar
    3 posts
    Member since:
    Feb 2014

    Posted 04 Jul 2014 Link to this post

    Hello,

    I am trying to override the POST method of the client side functionality on a ListView, but I cannot figure out a way to do it, since apparently there is no event in ClientEvents that's triggered once the items are being requested.
    My goal is to pass a parameter to the service.

    As an example, I am pointing out the functionality available in RadComboBox, called "OnClientItemsRequesting", in which I am able to get the context and set a custom property, as easily as:

    function CountyItemsRequesting(sender, eventArgs) {
        var context = eventArgs.get_context();
        context.District = $find("<%= ddlDistrict.ClientID %>")._value;
    }


    My question is:
    Is there any way at all to pass a parameter as POST in the ListView control?

    Thank you in advance!


  2. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 09 Jul 2014 Link to this post

    Hi Jorge,

    If the RadListView will use client-side data-biding you can bind it to a RadClientDataSource control as demonstrated here. Once this is done you can subscribe to the OnCustomParameter event of the client data source and pass a parameter to the select call. A sample on how to pass the value in the described manner is available in this online demo. Note that in the online example the customersJSON parameter in the ParameterMap event handler is passed only for the insert, update and delete calls. In order to pass it for the select call one should modify the logic as demonstrated below.

    JavaScript:
    function ParameterMap(sender, args) {
               if (args.get_type()== "read" && args.get_data()) {
                   args.set_parameterFormat({ parameterName: "someValue" });
               }
           }

    Another option for you would be to programmatically bind the RadListView as demonstrated here and handle all the operations manually after cancelling the client OnCommand event.

    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jorge
    Jorge avatar
    3 posts
    Member since:
    Feb 2014

    Posted 09 Jul 2014 Link to this post

    Thank you very much for your answer.

    In fact, I was not aware of the existence of the ClientDataSource control, which is definitely most useful.

    Programatically binding would not be an option for me, since I am loading data from a few sources, which would make the page load terribly slow.

    Regards,
    Jorge Ferreira
Back to Top