This is a migrated thread and some comments may be shown as answers.

the second level in radgrid not bind

2 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
niloofar
Top achievements
Rank 1
niloofar asked on 07 Sep 2010, 07:03 AM
hi
i use these code for bind radgrid
but just first level bind
both of datasource is full
please help to me
protected void Button1_Click(object sender, EventArgs e)
        {
  
            RadGrid RadGrid1 = new RadGrid();
            RadGrid1.ID = "RadGrid1";
            RadGrid1.DataSource = ResultSearch();
            RadGrid1.MasterTableView.DataKeyNames = new string[] { "ShareHolderID" };
            RadGrid1.Width = Unit.Percentage(98);
            RadGrid1.PageSize = 3;
            RadGrid1.AllowPaging = true;
            RadGrid1.AllowSorting = true;
            RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            RadGrid1.AutoGenerateColumns = false;
            RadGrid1.ShowStatusBar = true;
            RadGrid1.MasterTableView.ExpandCollapseColumn.Visible = true;
            RadGrid1.MasterTableView.PageSize = 3;
            GridBoundColumn boundColumn;
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "ShareHolderID";
            boundColumn.HeaderText = "ShareHolderID";
            RadGrid1.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "FirstName";
            boundColumn.HeaderText = "FirstName";
            RadGrid1.MasterTableView.Columns.Add(boundColumn);
            IQueryable<CDSStockDataAccess.tS002ShareHoldersInfo> shareholderinfo = CDSStockLogic.BusinessObjects.UI.ShareHolderInfo.RetrieveShareHolder("2");
            GridTableView tableViewOrders = new GridTableView(RadGrid1);
            tableViewOrders.DataSource = shareholderinfo;
            tableViewOrders.Width = Unit.Percentage(100);
            tableViewOrders.DataKeyNames = new string[] { "_ShareHolderInfoID" };
            GridRelationFields relationFields = new GridRelationFields();
            relationFields.MasterKeyField = "ShareHolderInfoID";
            relationFields.DetailKeyField = "ShareHolderInfoID";
            tableViewOrders.ParentTableRelation.Add(relationFields);
            RadGrid1.MasterTableView.DetailTables.Add(tableViewOrders);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "ShareHolderInfoID";
            boundColumn.HeaderText = "ShareHolderInfoID";
            tableViewOrders.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Address";
            boundColumn.HeaderText = "Address";
            tableViewOrders.Columns.Add(boundColumn);
            this.PlaceHolder1.Controls.Add(RadGrid1);
            RadGrid Grid1 = (RadGrid)PlaceHolder1.FindControl("RadGrid1");
            RadGrid1.MasterTableView.Items[0].Expanded = true;
            Grid1.SelectedIndexes.Add(1, 0);
        }

2 Answers, 1 is accepted

Sort by
0
niloofar
Top achievements
Rank 1
answered on 07 Sep 2010, 07:09 AM
it is very important
please help
0
niloofar
Top achievements
Rank 1
answered on 07 Sep 2010, 07:20 AM
thanks solved
Tags
Grid
Asked by
niloofar
Top achievements
Rank 1
Answers by
niloofar
Top achievements
Rank 1
Share this question
or