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

Pass parameter to webservice on node expand

5 Answers 272 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Nicholas
Top achievements
Rank 1
Nicholas asked on 26 Mar 2011, 12:14 AM
Hi,
I am using the webservice method of populating my radtreeview as it was described as the most efficient way to load large amounts of data. So the signature of my webservice method is:

[WebMethod]
public RadTreeNodeData[] WebServiceMethodName(RadTreeNodeData node, object context)

However, the nodes that I am populating the tree with depend on the security access of the user that is logged in to my application..
Is it possible to pass additional parameters to the webservice method? Or must I use a ServerSideCallBack method to populate the tree? I am hoping that I can still use the webservices functionality... I would like to pass a signature like this to my webservice method:
[WebMethod]
public RadTreeNodeData[] WebServiceMethodName(RadTreeNodeData node, object context, object userSession)

I look forward to your response. Thank you!

5 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Tsenkov
Telerik team
answered on 31 Mar 2011, 08:48 AM
Hi Nicholas,

The ClientNodePopulating event can be used to pass parameters to the web service through the "context" dictionary.

function nodePopulating(sender, eventArgs)
{
    var node = eventArgs.get_node();
    var context = eventArgs.get_context();
    context["CategoryID"] = node.get_value();
}


Regards,
Nikolay Tsenkov
the Telerik team
0
Gary
Top achievements
Rank 1
answered on 14 May 2011, 12:56 AM
Very useful information. I spent hours today finding the response to this and how to pass parameters back in. Our situation is slightly different, and this solves the first half. I have a treeview with checkboxes. I need to pass back a parameter to specific the mode (edit/view) and when in edit mode I use the authenticated user ID to get a list of nodes they have selected and compare it with the nodes that I'm about to send back.

The problem is, using the web service method, how to I notify the treeview to set a box as checked from the web service? The

RadTreeNodeData

 

 doesn't seem to have a property for checked.

Is there something that I'm missing?

 

0
Nikolay Tsenkov
Telerik team
answered on 19 May 2011, 09:06 AM
Hi Nicholas,

You can use the attributes collection of RadTreeNodeData, in order to sent the checked value to the client.


Regards,
Nikolay Tsenkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Gary
Top achievements
Rank 1
answered on 19 May 2011, 08:24 PM
Thanks for the follow up.

I see that now. I was able to piece it together by reading several different posts. The most critical section that I was missing was the function definition for "node.set_checked(true)" which begs the question, what is the most current location for finding documentation for the client side api methods available? I found several links but they were all broken.

0
Nikolay Tsenkov
Telerik team
answered on 20 May 2011, 04:22 PM
Hi Nicholas,

All of the RadControls for ASP.NET AJAX have this section in their Online Help Documentation, called Client-Side Programming and there you can find the API of all client-objects that are created by the controls.

About the problematic links - could you, please, send us the broken links, so we can make sure they are being fixed? Thanks!


Regards,
Nikolay Tsenkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
TreeView
Asked by
Nicholas
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Gary
Top achievements
Rank 1
Share this question
or