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
450
Choose sub-value for column
posted

Hello:

I have an UltraGrid bound to an object of mine, let's call it MainObject. It has a bunch of properties that are mostly primitives e.g. Name string, ID int. It also has a child object called ChildObject that has other fields e.g. ChildName or ChildId.

What I'm seeing after loading the dataset for MainObject onto the grid is a set of columns bound normally to the primitives and an extra column 'ChildObject'...that displays during runtime as simply "Namespace.ChildObject'.

How can I configure the column to show a particular field of ChildObject e.g. ChildID? I've been poking around for hours and all I can see is that it keeps treating that object as a primitive and can't let me control the actual value shown.

Parents
No Data
Reply
  • 53790
    posted

    Hello Borong,

    The mentioned behavior is expected, but maybe one possible way to achieve desired behavior could be if you are using Unbound column into your grid. This Unbound column will display desired information from your ChildObject
    If you want you could hide the coulmn that display your "Namespave.ChildObject".
    Please take a look at the code below and attached video for more details.

    // Create Unbound Column
    ultraGrid1.DisplayLayout.Bands[0].Columns.Add("MyKey", "MyUnboundColumn");
    ultraGrid1.DisplayLayout.Bands[0].Columns["MyKey"].DataType = typeof(string);


    // Handle InitializeRow
    private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
    {
       e.Row.Cells[MyKey].Value = ((MntTaskCode)e.Row.Cells[2].Value).Description;
    }

    Please let me know if you have any questions.
    Regards

Children