How to pass parameter to webservice when using Load on demand

2 posts, 1 answers
  1. Edwin
    Edwin avatar
    27 posts
    Member since:
    Jun 2012

    Posted 23 Sep 2011 Link to this post

    I followed the example in live demo and found that the signature of the webservice method must be

    public RadRotatorItemData[] GetRotatorData(int itemIndex)

    Does that mean there is no way to pass any custom parameter to the webservice method?


  2. Answer
    Slav avatar
    1359 posts

    Posted 28 Sep 2011 Link to this post

    Hi Edwin,

    You can pass a custom parameter to the WebService method by following these steps:

    1. Attach a handler to the client event OnClientItemsRequesting and implement it as demonstrated below:
      <script type="text/javascript">
          function OnClientItemsRequesting(oRotator, args)
      The string "value" will be passed to the parameter argument of the WebService method, when a request is made.
    2. Then you can get the value in the WebService as shown in the following code sample:
      public RadRotatorItemData[] GetRotatorData(int itemIndex, string argument)
      Please note that the name of the argument should be kept the same, in order to ensure proper functionality.

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top