Pass parameter to webservice on node expand

6 posts, 1 answers
  1. Nicholas
    Nicholas avatar
    11 posts
    Member since:
    Jan 2011

    Posted 25 Mar 2011 Link to this post

    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!

  2. Answer
    Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 31 Mar 2011 Link to this post

    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
  3. Gary
    Gary avatar
    8 posts
    Member since:
    Aug 2009

    Posted 13 May 2011 Link to this post

    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?

     

  4. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 19 May 2011 Link to this post

    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.

  5. Gary
    Gary avatar
    8 posts
    Member since:
    Aug 2009

    Posted 19 May 2011 Link to this post

    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.

  6. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 20 May 2011 Link to this post

    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.

Back to Top