Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
WinGrid BindingSource binding
posted

Normal 0 false false false MicrosoftInternetExplorer4

Hi,

 

I am new to Infragistics Controls, I am playing with Infragistics WinGrid with Binding Source. I have two Class Employee & Manager and manager class looks like that

 

public class Manager

    {

        public string Name { get; set; }

        public string Description { get; set; }

 

        public BindingList<Employee> Employees { get; set; }

 

        public Manager()

        {

            Employees = new BindingList<Employee>();

        }

    }

 

I have created parent child relationship with UltraWinGrid with Manager & employee. I have one textbox in which I want to display corresponding employee whenever use clicks on the employee records from child of WinGrid. I am trying to bind the textEditor using the DataBinding like this

 

this.ultraTextEditor2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.employeeBindingSource, "Description", true));

 

Right now it is not working on clicking child node. Please suggest me some code using binding option   

  • 469350
    Suggested Answer
    Offline posted

    If the grid is showing the hierarchy here, then I assume the grid is bound to a BindingList of Managers, or a BindingSource that is pointing to a BindingList of Manager.

    So any employeeBindingSource you may create is not even going to be used by the grid. The grid gets the child data from the data source it is bound to.So you would need to bind your textbox to the same data source the grid is using and then use the DataMember to specify a field in the child list.

    I'm not sure of the exact syntax off the top of my head, it's been a while since I tried this. So I recommend that you consult Microsoft documentation on Binding. Or post on a general DotNet programming forum, since the question here really is not related to the grid.