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

Accessing RenderedFields

1 Answer 98 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
Developer
Top achievements
Rank 1
Developer asked on 23 Aug 2016, 01:01 PM

Hi,

I have extracted the xml for radorgchart.  Within this I have some rendered fields
When I attempt to use this xml to rebind another orgchart, within the databinding event I’d like to display the text of one rendered field within a label control.
I’m nearly there; I can see the rendered fields for a particular node:

 

node.GroupItems[0].RenderedFields


But I can’t figure out how to extract something from this collection, where the label is equal to something.
Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 25 Aug 2016, 10:51 AM
Hello,

If I understand correctly your scenario, you want to get the text from a specific node's rendered field and set it to a Label control. Since RenderedFields is a collection you can access the fields by their index, for example:
protected void RadOrgChart1_NodeDataBound(object sender, OrgChartNodeDataBoundEventArguments e)
{
    if (e.Node.GroupItems[0].Text == "John Doe")
    {
        Label1.Text = e.Node.GroupItems[0].RenderedFields[0].Text;
    }
}

So let's say you have two rendered fields declared:
<RenderedFields>
    <ItemFields>
        <telerik:OrgChartRenderedField DataField="position" />
        <telerik:OrgChartRenderedField DataField="budget" />
    </ItemFields>
</RenderedFields>

then RenderedFields[0].Text will get the text of the node's "position" field.

Regards,
Ivan Danchev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
OrgChart
Asked by
Developer
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or