Send ItemsPerRequest to RadComboBoxContext in WebServiceMethod

4 posts, 0 answers
  1. Björn Karlsson
    Björn Karlsson avatar
    5 posts
    Member since:
    Mar 2010

    Posted 22 Sep 2010 Link to this post

    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
    }

  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 22 Sep 2010 Link to this post

    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
  3. Björn Karlsson
    Björn Karlsson avatar
    5 posts
    Member since:
    Mar 2010

    Posted 22 Sep 2010 Link to this post

    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. 

  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 23 Sep 2010 Link to this post

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