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

Client Side Binding - Overriding POST

2 Answers 63 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Jorge
Top achievements
Rank 1
Jorge asked on 04 Jul 2014, 11:22 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Angel Petrov
Telerik team
answered on 09 Jul 2014, 08:51 AM
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.

 
0
Jorge
Top achievements
Rank 1
answered on 09 Jul 2014, 08:57 AM
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
Tags
ListView
Asked by
Jorge
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Jorge
Top achievements
Rank 1
Share this question
or