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. Image for the cookie policy date

GridBoundColumn for RelatedTable

Hello again, I have a GridDataBoundGrid, which is going to represent Hieratical Data, from 2 related Tables. Everything works fine, but now I need to change some header text for the Related Table Colums, and it doesn't work. I am able to create GridBoundColumn, for the main table, but for the related one... Can you help me? Attached is the file with the code. Thanking you in advance, Mihai Vlad

2 Replies

AD Administrator Syncfusion Team July 2, 2003 04:54 AM

Your code GridBoundColumn clmnStyle_rCode = gridBinder.InternalColumns["rCode"]; clmnStyle_rCode.HeaderText = "Code"; clmnStyle_rCode.StyleInfo.CellValueType = typeof(string); clmnStyle_rCode.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Right; attempts to get the GBC from the parent grid's GBC collection, and modify it and put it in the child grid's GBC collection. A couple of sticky points here. One is the mappingnames for the two columns are not necessarily the same, are they? So, you may want to change that property as well. Another problem is that you are modifying a reference to the parent GBC. This will cause problems. So, instead of your first line above, try this: GridBoundColumn clmnStyle_rCode = gridBinder.InternalColumns["rCode"].Clone(); There may be other problems, but maybe not...


MV Mihai Vlad July 2, 2003 05:40 AM

Thanks Clay. I found the solution and I want to share it with others. The idea is to "bind" the GridBoundColumn to the child GridHierarchyLevel'Internal column. The Bider does not contain the childs's grid Internal columns. This is so far the only solution that works. (The code that I gave you had some childish errors :) I agree) this.adptInput.Fill(this.dsInputList, "Input"); this.adptReel.Fill(this.dsInputList, "tblReel"); dsInputList.Relations.Add( dsInputList.Tables[0].Columns["iID"], dsInputList.Tables[1].Columns["rInputID"]); dsInputList.Relations[0].RelationName = "Reels_Relation"; GridHierarchyLevel hlInput = gridBinder.RootHierarchyLevel; GridHierarchyLevel hlInput_Reels = gridBinder.AddRelation("Reels_Relation"); // // clmnStyle_rCode // GridBoundColumn clmnStyle_rCode = hlInput_Reels.InternalColumns["rCode"]; clmnStyle_rCode.HeaderText = "Code"; clmnStyle_rCode.MappingName = "rCode"; clmnStyle_rCode.StyleInfo.CellValueType = typeof(string); clmnStyle_rCode.StyleInfo.HorizontalAlignment = Syncfusion.Windows.Forms.Grid.GridHorizontalAlignment.Right;

Loader.
Live Chat Icon For mobile
Up arrow icon