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
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.
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.
I am attaching a sample web page where the is isolated a scenario with RadOrgChart with web services.
Hope this will be helpful.
Plamen
the Telerik team
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();
}
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.
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.
Plamen
the Telerik team
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
I am attaching a sample project in VS2010 with sample web service binding of RadOrgChart.
Hope this will be helpful.
Plamen
Telerik
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.
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?
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