We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding columns to GridHierarchyLevel does not work?

Thread ID:

Created:

Updated:

Platform:

Replies:

18977 Sep 15,2004 01:18 AM UTC Sep 15,2004 05:44 AM UTC Windows Forms 1
loading
Tags: GridControl
Michael Feinstein
Asked On September 15, 2004 01:18 AM UTC

Attached is simple project, dataset with 2 small related tables. I am trying to manually configure columns for nested tables in DataBoundGrid, however if I manually add column to GridHierarchyLevel, the data is not displayed (even though header has correct text). Quick analysis shows that generated Internal Column for nested table is missing the Property Descriptor (parent table is generated and displayed properly), even though I do explicitly call Binder.InitializeColumns(); Please help ? sample_5155.zip

Administrator [Syncfusion]
Replied On September 15, 2004 05:44 AM UTC

Instead of trying to populate level.GridBoundCOlumns with new GridBoundColumns, try using level.LayoutColumns. This will just use teh columns that are already there and move them into level.GridBoundColumns. Below is your formload with this done. It displays 1 column at both teh parent and child level for me. private void Form1_Load(object sender, System.EventArgs e) { dataset11.Loadtag_Record.AddLoadtag_RecordRow(1, "123", 1, 1); dataset11.Loadtag_Record.AddLoadtag_RecordRow(2, "456", 1, 1); dataset11.Loadtag_Data.AddLoadtag_DataRow(dataset11.Loadtag_Record[0], 1, "1"); dataset11.Loadtag_Data.AddLoadtag_DataRow(dataset11.Loadtag_Record[0], 2, "2"); dataset11.Loadtag_Data.AddLoadtag_DataRow(dataset11.Loadtag_Record[1], 3, "3"); dataset11.AcceptChanges(); gridDataBoundGrid1.DataSource = dataset11.Loadtag_Record; ////// Syncfusion.Windows.Forms.Grid.GridHierarchyLevel lvl = gridDataBoundGrid1.Binder.AddRelation(dataset11.Loadtag_Record.ChildRelations[0].RelationName); ////// Syncfusion.Windows.Forms.Grid.GridBoundColumn parentColumn = new Syncfusion.Windows.Forms.Grid.GridBoundColumn(); ////// parentColumn.MappingName = "OrderID"; ////// parentColumn.HeaderText = "OrderID"; ////// gridDataBoundGrid1.GridBoundColumns.Add(parentColumn); // Without next 4 lines grid works, but displays all 4 columns, // What to do if I want only one? ////// Syncfusion.Windows.Forms.Grid.GridBoundColumn childColumn = new Syncfusion.Windows.Forms.Grid.GridBoundColumn(); ////// childColumn.MappingName = "LoadNumber"; ////// childColumn.HeaderText = "LoadNumber"; ////// lvl.GridBoundColumns.Add(childColumn); Syncfusion.Windows.Forms.Grid.GridHierarchyLevel lv0 = this.gridDataBoundGrid1.Binder.RootHierarchyLevel; lv0.LayoutColumns(new string[]{"OrderID"}); Syncfusion.Windows.Forms.Grid.GridHierarchyLevel lvl = gridDataBoundGrid1.Binder.AddRelation(dataset11.Loadtag_Record.ChildRelations[0].RelationName); lvl.LayoutColumns(new string[] {"LoadNumber"}); ////// gridDataBoundGrid1.Binder.InitializeColumns(); gridDataBoundGrid1.Refresh(); }

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;