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

How to pass parameter from client side to server side

4 Answers 254 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jahangir
Top achievements
Rank 2
Jahangir asked on 01 Nov 2014, 05:10 AM
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.

4 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 04 Nov 2014, 02:37 PM
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.

 
0
Jahangir
Top achievements
Rank 2
answered on 11 Nov 2014, 04:28 AM
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.
0
Accepted
Nencho
Telerik team
answered on 13 Nov 2014, 04:42 PM
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.

 
0
Jahangir
Top achievements
Rank 2
answered on 16 Nov 2014, 03:47 AM
Thank you for your help @Nencho
Tags
DropDownList
Asked by
Jahangir
Top achievements
Rank 2
Answers by
Nencho
Telerik team
Jahangir
Top achievements
Rank 2
Share this question
or