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

Connect to webservices

12 Answers 132 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
Søren Aamand
Top achievements
Rank 1
Søren Aamand asked on 14 Feb 2013, 10:02 AM
I find the OrgChart control really interesting and would like to use the control to show and modify the organization of various customers. However, I find that the contruction of the javascript takes a substantial amount of time when the organization consists of more than a few hundreds/thousand units. I understand that this is caused by the fact that all units from the datasource is loaded by the control and not just the once that is shown on the screen.

Luckily, the 2012Q3 release contain the webservice option as demoed at http://demos.telerik.com/aspnet-ajax/orgchart/examples/populatingwithdata/webservicebinding/defaultcs.aspx. This really seems like the way for us to go. However, we haven't succeeded using the webservice functionality, and we are not able to connect the control to the two WCF services that we have created. We are unsure how to use the two WebServiceBindings collection and have tried with both various URI's and labels to services referenced for RadOrgChart2.WebServiceBindings.GroupEnabled.GroupItemServiceSettings.Path. The two services are running when the aspx file is lanched but they aren't called when hitting one of the two extend buttons. Using Fiddler we get a http code 400 or 404 depending on our current setting. We have not been able to find any helpful documentation or forum tips that could help us out.

Will it be possible to get a working VS solution included the aspx page and the two services from the demo-page (preferable C#)? Or alternatively, some additional information on how to setup the WCF services and customy the OrgChart control to connect to the services?

Thanks.

12 Answers, 1 is accepted

Sort by
0
Søren Aamand
Top achievements
Rank 1
answered on 17 Feb 2013, 02:07 PM
The support was kind enough to send me a working call to the webservices. It was the web.config of mine that wasn't complete.
0
Thanh
Top achievements
Rank 1
answered on 10 May 2013, 05:50 PM
Can you please attach a copy of the web services projects?  I am unsure how to get started with the web services connection for the org chart control.  It needs to be still get the original data from a database.  Is the web service(s) a different .NET project?

Originally we were trying to do simple binding. But it was taking too long to load more than 5 levels.  So we need to move towards load on demand when the + expand symbol is clicked and only then will the data be retrieved for that next level of nodes.

Any help would be appreciated.  Thanks.
0
Thanh
Top achievements
Rank 1
answered on 13 May 2013, 08:27 PM
I am new to WCF so any help would be appreciated.

I am following the "SIMPLE BINDING" example.  I added a file to the existing web application project called OrgChartGroupItemData.svc and copied the example from your online web service example (changing the LoadData example to make a SQL connection and run a SQL command to have a data adapter fill in the data table). 

When I tried to view the new .svc page in the browser, I get an error message saying "...multiple request body parameters to be serialized without any wrapper elements. At most one body parameter can be serialized without wrapper elements. Either remove the extra body parameters or set the BodyStyle property ".

So I added the following under OperationContract:

 

[

 

WebInvoke(BodyStyle=WebMessageBodyStyle.Wrapped)]

 

 

 

Now I get "Endpoint not found".  So I think I have to add something to the web.config?  What other changes do I need to make to the .svc file to make it work?  I started to mess around with the web.config, but do you have an example of this that goes with the online web services example?  Thanks in advance.

0
Plamen
Telerik team
answered on 15 May 2013, 05:55 PM
Hi,

 
I am attaching a sample web page where the is isolated a scenario with RadOrgChart with web services.

Hope this will be helpful.

Greetings,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Thanh
Top achievements
Rank 1
answered on 15 May 2013, 11:35 PM
Thank you for the sample files (although it is not the visual studio solution so I can't compile/run it locally to test).  In any case, it does help me resolve some issues with the web.config.  Note that I am trying to run this against .NET 3.5, not 4, so there are some things that are not working

I am still a bit confused.  In looking at the online example:  http://www.telerik.com/help/aspnet-ajax/orgchart-web-service.html  as well as the demo, it is still doing a databind on page_load.  When I click to expand out the node to get the children, i thought that it should be calling the web service.  Instead, it is just re-running page_load again and rebinding.

Also, I don't see anywhere in the sample code where it is setting the load on demand to "nodes".  In fact, this setting is not even set.  So I am a little confused.

I need to do a simple bind (not group bind) and show the 1st 3 levels.  Is the initial display of this data via the web service or is it via a sql databind (like what I see in the example). When the user attempts to expand out further, it should retrieve the additional data via web services (and so should be fast).

Example of default.aspx (demo version):

public partial class TelerikWebForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        var teams = new DataTable();
        teams.Columns.Add("TeamID");
        teams.Columns.Add("ReportsTo");
        teams.Columns.Add("Team");
        teams.Rows.Add(new string[] { "1", null, "Management" });

        RadOrgChart2.WebServiceBindings.GroupEnabled.GroupItemServiceSettings.Method = "LoadData";
        RadOrgChart2.WebServiceBindings.GroupEnabled.GroupItemServiceSettings.Path = "OrgChartGroupItemDataService.svc";

        RadOrgChart2.WebServiceBindings.GroupEnabled.NodeServiceSettings.Method = "LoadData";
        RadOrgChart2.WebServiceBindings.GroupEnabled.NodeServiceSettings.Path = "OrgChartNodeDataService.svc";

        RadOrgChart2.GroupEnabledBinding.NodeBindingSettings.DataFieldID = "TeamID";
        RadOrgChart2.GroupEnabledBinding.NodeBindingSettings.DataFieldParentID = "ReportsTo";
        RadOrgChart2.RenderedFields.NodeFields.Add(new OrgChartRenderedField() { DataField = "Team" });

        RadOrgChart2.GroupEnabledBinding.NodeBindingSettings.DataSource = teams;
        RadOrgChart2.DataBind();
    }
}


My version:

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

RadOrgChart1.GroupColumnCount = 3;

RadSkinManager1.ShowChooser =

 

false;

 

RadSkinManager1.Enabled =

 

false;

 

  

RadOrgChart1.DataFieldID =

 

"EmployeeID";

 

RadOrgChart1.DataFieldParentID =

 

"SupervisorEmployeeID";

 

RadOrgChart1.LoadOnDemand =

 

OrgChartLoadOnDemand.Nodes ;

 

 

 

RadOrgChart1.WebServiceBindings.Simple.GroupItemServiceSettings.Method =

 

"LoadData";

 

RadOrgChart1.WebServiceBindings.Simple.GroupItemServiceSettings.UseHttpGet =

 

false;

 

RadOrgChart1.WebServiceBindings.Simple.GroupItemServiceSettings.Path =

 

"WebApplication1.OrgChartGroupItemDataService.svc";

 

RadOrgChart1.DataSourceID =

 

"Sqldatasource1";

 

RadOrgChart1.DataBind();

}

Is there a strictly simple bind example that you can point me to?  Thanks!
0
Thanh
Top achievements
Rank 1
answered on 17 May 2013, 01:45 AM
Also, in the example, I had to remove from the web.config's serviceHostingEnvironment the line:

multipleSiteBindingsEnabled=true

because this was a .NET 4 only entry.  This has to work on a .NET 3.5 server. Will that cause any issues?

I also had to deviate from the sample code and add things like this because the WCF service wouldn't even come up cleanly when you browse to it.

<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
 
I am still unable to get data back when I expand beyond the initial node. When I click on the expansion plus symbol, it leads to nothing. Here's a portion of the web.config:

    <behavior name="ThanhWcfServiceBehavior">
     <serviceMetadata httpGetEnabled="true"/>
     <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
   </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  <services>
   <service name="WebApplication1.OrgChartNodeDataService" behaviorConfiguration="ThanhWcfServiceBehavior">
    <endpoint address="" behaviorConfiguration="OrgChartNodeDataServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="WebApplication1.OrgChartNodeDataService"/>
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
        <!-- Uncomment the below setting to enable WCF services if you are deploying the site under HTTPS -->
    <!--<endpoint address="" behaviorConfiguration="OrgChartNodeDataServiceAspNetAjaxBehavior"
                   binding="webHttpBinding" bindingConfiguration="secureBinding" contract="OrgChartNodeDataService" />-->
   </service>
   <service name="WebApplication1.OrgChartGroupItemDataService" behaviorConfiguration="ThanhWcfServiceBehavior">
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
    <endpoint address="" behaviorConfiguration="OrgChartGroupItemDataServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="WebApplication1.OrgChartGroupItemDataService"/>
    <!-- Uncomment the below setting to enable WCF services if you are deploying the site under HTTPS -->
    <!--<endpoint address="" behaviorConfiguration="OrgChartGroupItemDataServiceAspNetAjaxBehavior"
                   binding="webHttpBinding" bindingConfiguration="secureBinding" contract="OrgChartGroupItemDataService" />-->
   </service>
  </services>
 </system.serviceModel>

Any help would be appreciated.  At this point, I don't know if the issues are related to .NET 3.5 or if there's something else going on.
0
Plamen
Telerik team
answered on 20 May 2013, 11:01 AM
Hi,

 I am attaching a sample web page that is working at my site with 3.5 version of RadControls. You can just open it as web page as on the video here.

Hope this will be helpful.

Regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Thanh
Top achievements
Rank 1
answered on 21 May 2013, 03:51 PM
I am trying to view the web page in browser but I get the following error.  In any case, do you have a working example of using wcf web services for SIMPLE binding.  In other words, no groupings.  SIMPLE binding to web services using an item template?

 

Server Error in '/OrgChartService35' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

Source Error:

 

Line 2:  using System.Collections.Generic;
Line 3:  using System.Data;
Line 4:  using System.Linq;
Line 5:  using System.Runtime.Serialization;
Line 6:  using System.ServiceModel;
 

Source File: c:\Work\telerik_35\OrgChartService35\App_Code\OrgChart\OrgChartGroupItemDataService.cs    Line: 4

0
Plamen
Telerik team
answered on 24 May 2013, 01:30 PM
Hi,

I am attaching a sample project in VS2010 with sample web service binding of RadOrgChart.

Hope this will be helpful.
 

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Thanh
Top achievements
Rank 1
answered on 17 Jun 2013, 08:47 PM
Just in case anyone else is having this issue:  Here is the resolution:

The underlying issue was that I had ALSO set the setting for loadondemand="Groups and Nodes".

But you can't have both the loadondemand setting AND web services binding on at the same time.  It defaults to loadondemand and therefore was ignoring the web services binding.  I deleted the loadondemand attribute setting and it started working.
0
Siddhartha
Top achievements
Rank 1
answered on 05 Nov 2013, 04:49 PM
Hi,

I have similar kind of situation. I'm Using Webservice to bind the data. I have thousands of nodes.
I have followed this  http://demos.telerik.com/aspnet-ajax/orgchart/examples/populatingwithdata/webservicebinding/defaultcs.aspx. sample and its working.

The Only issue i'm facing is I'm using Group Binding. So I have Groups data and nodes data.
Groups is showing a message like "Expand to load items" . so its doing load on demand for groups also. I don't want this to happen. 
I want to load nodes on demand but groups should be loaded without any click.
I tried  'LoadOnDemand="Nodes" ' but it doesn't work and I thinks its not the correct way. (as I'm using Service binding) .

So Is there any way I can accomplish my scenario?

0
Plamen
Telerik team
answered on 08 Nov 2013, 03:17 PM
Hi,

 
Unfortunately loading both nodes and items at one request is not supported by RadOrgChart but one possible workaround is to trigger the GroupItems click once the nodes are loaded as for example in the code below:

<script type="text/javascript">
           function OnClientNodePopulated(sender, args) {
               $telerik.$(args.get_node().get_element()).find(".rocExpandGroupArrow").each(function myfunction(index, item) {
                   if (index>0) {
                       $telerik.$(this).click();
                   }
               });
           }
       </script>

Hope this will be helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
OrgChart
Asked by
Søren Aamand
Top achievements
Rank 1
Answers by
Søren Aamand
Top achievements
Rank 1
Thanh
Top achievements
Rank 1
Plamen
Telerik team
Siddhartha
Top achievements
Rank 1
Share this question
or