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

[Solved] Programatically create RadGrid loads as a thick line when loaded on page load

1 Answer 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kiran
Top achievements
Rank 1
kiran asked on 07 May 2009, 09:27 PM
I am creating and binding hierarchical grid on page load, it comes up as a thick horizontal line but on click of button i call the same code block again and grid shows up properly. Can you please tell me why on page load it shows up as line?
I am using following code:
 RadGrid grid = new RadGrid();
            grid.ID = "grid" + id.ToString();
            grid.AutoGenerateColumns = false;
            grid.GridLines = GridLines.None;
            grid.EnableViewState = true;
           // grid.Style.Add(HtmlTextWriterStyle.Height, "200px");
            grid.MasterTableView.AutoGenerateColumns = false;
            grid.MasterTableView.ExpandCollapseColumn.Visible = true;
            grid.MasterTableView.Columns.Add(GenerateBoundColumn("columnA", "columnA", "columnA", false));
            grid.MasterTableView.Columns.Add(GenerateBoundColumn("columnB", "columnB", "columnB", true));
            grid.MasterTableView.Columns.Add(GenerateBoundColumn("columnC", "columnC", "columnC", true));
            grid.MasterTableView.Columns.Add(GenerateBoundColumn("columnD", "columnD", "columnD", true));
            grid.MasterTableView.HierarchyDefaultExpanded = true;
            grid.MasterTableView.DataSource = GetData(id);
            grid.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerBind;
            GridTableView details = new GridTableView();
            details.Width = Unit.Percentage(100);
            details.Columns.Add(GenerateHTMLEditorColumn("rsTable","rsTable","rs",true));
            grid.DetailTableDataBind += new GridDetailTableDataBindEventHandler(RadGrid_DetailTableDataBind);
            grid.MasterTableView.DetailTables.Add(details);
            placeHolder.Controls.Add(grid);
            grid.MasterTableView.DataBind();

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 11 May 2009, 09:03 AM
Hi Kiran,

Hierarchical RadGrid should be created programmatically in PageInit event. Please refer to following help article (under Create hierarchical grid programmatically section) for more details.
For a live example you can review the following link:
Creating Hierarchy Programmatically

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
kiran
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or