When i use in the OrgChart , the business object to databinding ,it's work very well.
But if my Root guy on the OrgChart do not Containd parent_id == 0, the orgchart doesn't work ! and doesn't appear.
My customer use the multi level marketing (mlm) , and if the user root get a tree , it's possible his parent_id don't get a Zero in his value.
It's possible to correct in the OrgChart
id parent_id
5 4
6 5
7 5
8 5
it' should be work.
thanks
8 Answers, 1 is accepted
Such structure is invalid. The OrgChart expects to have at least one root item, where the parent_id is null.
For example:
id parent_id
5 4
6 5
7 5
8 5
4 null
However if the data returned by your database is similar, try to put this data in some collection of objects, then replace all 0 with NULL values. Finally bound the OrgChart to the collection with the valid data.
DB <-> Collection <-> OrgChart
Regards,
Hristo Valyavicharski
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Can you accept Zero : "0" or null value in ROOT item : please ?
I don't usually use Null value in my database.
thanks
Olivier
As far as I know this is not possible because DataFieldParentID must be null if it is of nullable (e.g. int?) or reference (e.g. string) type.
Thanks,
Shinu.
everything is possible, in programming, if you will not start at the root node,
Why Would not this option?
I had to make a view to work around this big problem.
it's not difficult to accept any value, to start the root what we want.
Do you understand me ?
The DataFieldParentID cannot be null when the OrgChart is populated from a database. For example if you have the following table structure:
int ID (Primary Key)
nvarchar Text
int ParentID (Foreign Key)
the dababase will not allow you to enter new record, where the ParentID is 0 and if there are not record with ID=0.
However it is possible to populate the OrgChart with the following code:
<
telerik:RadOrgChart
runat
=
"server"
ID
=
"orgChart"
></
telerik:RadOrgChart
>
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<Item> items = new List<Item>();
for (int i =
0
; i <
3
; i++)
{
items.Add(new Item()
{
Id = i,
Name =
"Parent "
+ i.ToString(),
ParentID =
0
});
}
for (int i =
0
; i <
3
; i++)
{
items.Add(new Item()
{
Id = i,
Name =
"Child "
+ i.ToString(),
ParentID =
1
});
}
orgChart.DataSource = items;
orgChart.DataTextField =
"Name"
;
orgChart.DataFieldID =
"Id"
;
orgChart.DataFieldParentID =
"ParentID"
;
orgChart.DataBind();
}
}
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public int ParentID { get; set; }
}
Regards,
Hristo Valyavicharski
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
In orgChart, the null value for the parent id , is the BIG BOSS == CEO
If we want to start with Chief Employee only , it's not possible without your difficulty code not plug and play !
I'm not sure if I understood correctly what the problem is. The OrgChart can display all kind of hierarchical structures. So if your data base is something similar to this http://screencast.com/t/J7TL8Gb8GbT
then you should get the desired behavior. http://screencast.com/t/NtuJZlroAo
To start with the "Chief Employee" only you can modify the select command of your data source.
Regards,
Hristo Valyavicharski
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Hi Friend,
I want to use orgchart in asp mvc with database i find code in internet with this methode
public ActionResult _OrgChart(){return Json(DiagramDataRepository.OrgChart(), JsonRequestBehavior.AllowGet);}
but i don't know how to use this and how to create this methode DiagramDataRepository.OrgChart()
please help mee