How to pass parameter from client side to server side

5 posts, 1 answers
  1. Jahangir
    Jahangir avatar
    3 posts
    Member since:
    Oct 2014

    Posted 01 Nov 2014 Link to this post

    I've 10 dropdownlist in one page. I want to bind this dropdownlists from client side. In jquery I just pass the dropdownlists id using ajax from client side to server side then I bind the data using jquery. But in telerik how can I do that. I am new here. So I don't know how to do that. Can any one help me please.
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 04 Nov 2014 Link to this post

    Hello Jahangir,

    In order to pass a preferable parameter to the server-side, you could use the OnClientItemsRequesting client-side event of the RadDropDownList and the context object (in a web-service binding scenario). Please refer to the following documentation article, demonstrating the implementation of the desired functionality:

    http://www.telerik.com/help/aspnet-ajax/dropdownlist-onclientitemsrequesting.html

    If the above approach is not suitable in your scenario, please demonstrate us the proper approach for databinding that you use, so we could try to provide you with the 

    Regards,
    Nencho
    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. Jahangir
    Jahangir avatar
    3 posts
    Member since:
    Oct 2014

    Posted 10 Nov 2014 in reply to Nencho Link to this post

    Hi Nencho,
    My webservice method receive one parameter which is dropdownlist ID. Using this ID I've populate every dropdownlist items. So, I want to pass the every dropdownlist ID in my webservice method from the client side.

    Otherwise, I've to create 10 webservice methods for the 10 dropdownlist for populate their items.

     In normal jquery I've just use the jquery Ajax call to pass the parameter to my webservice but in telerik I didn't find amy way to pass the parameter.

    Can you please show me a way how to pass parameter from client side to my webservice method.
  5. Answer
    Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 13 Nov 2014 Link to this post

    Hello Jahangir,

    As previously suggested, you can use the context of the ItemsRequesting client-side event, in order to pass any parameters to the specified WebServer. However, regarding your scenario, I would suggest you a slightly different approach.

    When some DropDownList is expanded, its request to the WebService is triggered automatically. This is why, I would suggest you to handle the aforementioned client-side event - OnClientItemsRequesting and pass only the ID of the DropDownList, which triggered the event. In such a manner, you can access this ID in the underlying WebService and perform the data binding, regarding the control which triggered the event.

    I have prepared a sample project for you, demonstrating the implementation of the above suggestion. In the clientItemRequesting, you can observe how the ID (custom parameter) is passed to through the context and in the WebService - how it is accessed.

    Regards,
    Nencho
    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.

     
  6. Jahangir
    Jahangir avatar
    3 posts
    Member since:
    Oct 2014

    Posted 15 Nov 2014 in reply to Nencho Link to this post

    Thank you for your help @Nencho
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017