New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Passing Context Information to the Server

On the client side, you can use the client-side OnClientGroupPopulating and OnClientNodePopulating events to set attributes of the context object that is passed to the server along with the request for groups/items. The context object is an object of type IDictionary.After the OnClientGroupPopulating and OnClientNodePopulating events fire those attributes are available on the server.

Using context information with a WebService

Below you may find an example that shows how to retrieve the text value typed in the text box and send this value to the web service. This attribute could be used to filter the RadOrgChart data in order to return only the teams containing this value.

  1. Add a javascript function to your Web page that serves the role of handler for the RadOrgChart OnClientNodePopulating client-side event.

  2. Add an filter attribute for the context object based on the value typed in the text box field.

  3. In this example the web service settings are set in the code behind files.

ASPNET
<script type="text/javascript">
    function OnClientNodePopulating(sender, args) {
        var nodeTextBoxID = "<%= NodeFilteringString.ClientID %>";
        var nodeFilteringString = $get(nodeTextBoxID).value;
        args.get_context()["NodeFilterString"] = nodeFilteringString;
    }

</script>
<telerik:RadOrgChart RenderMode="Lightweight" runat="server" ID="RadOrgChart2" OnClientNodePopulating="OnClientNodePopulating">
</telerik:RadOrgChart>
<telerik:RadTextBox RenderMode="Lightweight" ID="NodeFilteringString" runat="server"></telerik:RadTextBox>