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
310
Create Child bands using UltraDataSource
posted

I am creating a Log Grid where I have a set of rows in the Band[0] and for each row in this band there is a ChildBand with additional rows.

The code is the same of your tutorials ...

                    _gds = new UltraDataSource();

                    _gds.Band.Columns.Add("Id", typeof (Guid));

                    _gds.Band.Columns.Add("Type", typeof (string));

                    _gds.Band.Columns.Add("CreatedDate", typeof (DateTime));

                    _gds.Band.Columns.Add("CreatedUser", typeof (string));

                    _gds.Band.Columns.Add("PayoutCaption", typeof (string));

                    _gds.Band.Columns.Add("Message", typeof (string));

                    _gds.Band.ChildBands.Add("DetailBand").Columns.Add("Data", typeof (string));

 

                    foreach (MYLOG vo in _items)

                    {

                        UltraDataRow row = _gds.Rows.Add();

                        row["Id"] = vo.Id;

                        row["Type"] = vo.Type.ToString();

                        row["CreatedDate"] = vo.CreatedDate;

                        row["CreatedUser"] = vo.CreatedUser;

                        row["PayoutCaption"] = vo.PayoutCaption;

                        row["Message"] = vo.Message;

 

                        if (!string.IsNullOrEmpty(vo.Data))

                        {

                            var childRows = row.GetChildRows("DetailBand").Add();

                            childRows["Data"] = vo.Data;

                        }

                    }

I have also write the LayoutInitialize and InitializeRow in order to format the Grid appearence.
Well, I don't see at all the ChildBand but it's in the UltraDataSource ...
What am I missing?

Parents
  • 469350
    Offline posted

    I don't see anything wrong with this code. It looks like it should work.

    I am assuming, of course, that you are binding the grid to _gds. If not, you would not see the parent band, either, so I'm pretty sure that's a safe assumption.

    There are a couple of properties on the grid that would prevent it from displaying child bands. You might want to check to see if you are setting the ViewStyle on the grid to Single or the MaxBandDepth to 1.

    If that doesn't help, then I'm out of ideas. Can you post a small sample project demonstrating the issue? If so, I would be happy to take a look at it and tell you why it's not working.

Reply Children
No Data