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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridBoundColumn for RelatedTable

Thread ID:





5418 Jul 2,2003 05:13 AM UTC Jul 2,2003 09:40 AM UTC WinForms 2
Tags: GridControl
Mihai Vlad
Asked On July 2, 2003 05:13 AM UTC

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

Administrator [Syncfusion]
Replied On July 2, 2003 08:54 AM UTC

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...

Mihai Vlad
Replied On July 2, 2003 09:40 AM UTC

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;


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon