문제

I am wanting to create a hierarchy in a radgridview that is not data bound. So far, I haven't had any luck on figuring out how to do it.

I figured you could do something like:

Grid.Parent.Rows.Add(new object[] {});

and

Grid.Parent.Child.Rows.Add(new object[] {});

but I've had no such luck. The grid can't be data bound. I have a list of data I will loop through and create the hierarchy.

I need to know how to create parent nodes and child nodes for that parent. I saw the templates and have messed with them, but I can only make it work with a data source.

Can somebody point me in the right direction?

도움이 되었습니까?

해결책

Take a look at the second section in this article Binding to Hierarchical Data Programmatically

다른 팁

// Code for data bind radgridview

 void DataBInd()
        {

            var Source = Results.GetData(FromDate, Todate, drpLedger.Value);
            radGridLedgerAccount.DataSource = null;
            radGridLedgerAccount.DataSource = Source;
            FormatGrid();
            BindChildView();
            BindBarCharView(Source);
        }

//Code for bind childview i.e hierarchy

  void BindChildView()
        {
            if (drpLedger.Value != null)
            {


                GridViewTemplate childview = new GridViewTemplate();
                childview.Caption = "Details";
                childview.DataSource = null;
                childview.DataSource = Source;
                this.radGridLedgerAccount.MasterTemplate.Templates.Add(childview);

                FormatChildView(childview);
                GridViewRelation relation = new GridViewRelation(this.radGridLedgerAccount.MasterTemplate);
                relation.ChildTemplate = childview;
                relation.ParentColumnNames.Add("months");
                relation.ChildColumnNames.Add("NameOfMonth");
                this.radGridLedgerAccount.Relations.Add(relation);

            }
        }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top