public GridViewRowInfo AddNewRow(GridViewNewRowInfo newRow)
        {
            GridViewRowInfo        parent          = newRow.Parent as GridViewRowInfo;
            PropertyDescriptor     descriptor      = ListBindingHelper.GetListItemProperties(parent.DataBoundItem).Find(this.relation.ChildColumnNames[0], true);
            List <GridViewRowInfo> cachedChildRows = this.GetCachedChildRows(parent.DataBoundItem, descriptor);

            if (descriptor == null)
            {
                return((GridViewRowInfo)null);
            }
            IList list = descriptor.GetValue(parent.DataBoundItem) as IList;

            if (list != null)
            {
                this.SuspendNotifications();
                object          instance        = Activator.CreateInstance(ListBindingHelper.GetListItemType((object)list));
                GridViewRowInfo gridViewRowInfo = this.Template.Rows.NewRow();
                ((IDataItem)gridViewRowInfo).DataBoundItem = instance;
                gridViewRowInfo.SetParent(parent);
                foreach (GridViewColumn column in (Collection <GridViewDataColumn>)newRow.ViewTemplate.Columns)
                {
                    if (column.IsVisible && !column.ReadOnly && newRow.Cells[column.FieldName].Value != null)
                    {
                        gridViewRowInfo[column] = newRow.Cells[column.FieldName].Value;
                    }
                }
                list.Add(instance);
                cachedChildRows.Add(gridViewRowInfo);
                this.ResumeNotifications();
                return(gridViewRowInfo);
            }
            object obj = descriptor.GetValue(parent.DataBoundItem);

            if (obj == null)
            {
                return((GridViewRowInfo)null);
            }
            System.Type type = obj.GetType();
            if (!type.IsGenericType || type.IsGenericTypeDefinition)
            {
                return((GridViewRowInfo)null);
            }
            MethodInfo method = type.GetMethod("Add");

            if ((object)method == null)
            {
                return((GridViewRowInfo)null);
            }
            this.SuspendNotifications();
            object          instance1        = Activator.CreateInstance(ListBindingHelper.GetListItemType((object)list));
            GridViewRowInfo gridViewRowInfo1 = this.Template.Rows.NewRow();

            ((IDataItem)gridViewRowInfo1).DataBoundItem = instance1;
            gridViewRowInfo1.SetParent(parent);
            foreach (GridViewColumn column in (Collection <GridViewDataColumn>)newRow.ViewTemplate.Columns)
            {
                if (column.IsVisible && !column.ReadOnly && newRow.Cells[column.FieldName].Value != null)
                {
                    gridViewRowInfo1[column] = newRow.Cells[column.FieldName].Value;
                }
            }
            method.Invoke(obj, new object[1] {
                instance1
            });
            cachedChildRows.Add(gridViewRowInfo1);
            this.ResumeNotifications();
            return(gridViewRowInfo1);
        }