Accessing RenderedFields

2 posts, 0 answers
  1. Developer
    Developer avatar
    38 posts
    Member since:
    Apr 2014

    Posted 23 Aug Link to this post

    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?

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    830 posts

    Posted 25 Aug Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top