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

Send ItemsPerRequest to RadComboBoxContext in WebServiceMethod

3 Answers 151 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Björn Karlsson
Top achievements
Rank 1
Björn Karlsson asked on 22 Sep 2010, 10:54 AM
Hi,

I am using RadComboBox with WebServiceMethod. Why is it so that RadComboBoxContext doesn't contain ItemsPerRequest property.

<telerik:RadComboBox ItemsPerRequest="20" ..../>

I have also tried to manually add the ItemsPerRequest to the context (IDictionary) on the event OnClientItemsRequesting but i can't seem to find the propery ItemsPerRequest from javascript.

example code:

<telerik:RadComboBox ItemsPerRequest="20" OnClientItemsRequesting="onClientItemsRequesting" ..../>

//javascript
function onClientItemsRequesting(sender, eventArgs) {
var context = eventArgs.get_context();
        context["FilterString"] = eventArgs.get_text();
context["ItemsPerRequest"] = sender.ItemsPerRequest; // ? where can i find the property
}

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 22 Sep 2010, 11:02 AM
Hi Björn Karlsson,

The property is used only internally and during automatic Load On Demand, so this is the reason for it not being available as a property.

I suggest instead of setting it in the control's markup to use the value directly in your Web Method definition (you will still declare the property only once in your code) similarly to our demos.

Kind regards,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Björn Karlsson
Top achievements
Rank 1
answered on 22 Sep 2010, 03:54 PM
Yes, that is how our solution is working today.

But as our application/solution grows and in some cases we need our service to leverage a small "ItemsPerRequest" and sometimes with larger "ItemsPerRequest" i would have been a nice feature to get a hold of the correct "ItemsPerRequest" instead of having to create multiple service methods with static "ItemsPerRequest".

// What i want to do
ServiceMethod(object context)
{
//psuedo code
get items from service at page and take only context.ItemsPerRequest
}
// so that my markup code can use the same ServiceMethod with different request parameters
<telerik:RadComboBox Method="ServiceMethod" ItemsPerRequest="10" ../>
// on some other page
<telerik:RadComboBox Method="ServiceMethod" ItemsPerRequest="100" ../>   


// Your examples recommend
private static int ItemsPerRequest = 10;
ServiceMethod(object context)
{
//psuedo code
get items from service at page and take only ItemsPerRequest // (10)
}
ServiceMethodLarger(object context)
{
int itemsPerRequest = 100;
//psuedo code
get items from service at page and take only itemsPerRequest // (100)
}

What if i have 100, or more servicemethods.. Should i then create multiples of every method just to support larger ItemsPerRequest. I think it would be a nice feature to allow the ItemsPerRequest to be part of RadComboBoxContext. 

0
Simon
Telerik team
answered on 23 Sep 2010, 03:33 PM
Hello Björn Karlsson,

Your notes make perfect sense. Actually we did not consider exposing the property on the client as it was needed in automatic Load On Demand setups only and was introduced with the feature itself.


Still a case as the one you describe is pretty real and the same property could reduce much of the needed work. So we logged this as a feature suggestion and you can track its status here to know when it is ready. I also updated your Telerik points for the suggestion.

Regards,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
Björn Karlsson
Top achievements
Rank 1
Answers by
Simon
Telerik team
Björn Karlsson
Top achievements
Rank 1
Share this question
or