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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridDataBoundGrid Inheritance Designer issue

Thread ID:





36275 Oct 25,2005 05:01 PM UTC Oct 25,2005 10:13 PM UTC WinForms 5
Tags: GridControl
Krijn Michiels
Asked On October 25, 2005 05:01 PM UTC

Hi, The GDBG displays all datasource columns by default. When you edit the gridboundcolumns collection there are no columns shown ? Where are the gridboundcolumns displayed ? It would be very easier to edit the list (just put the correct headertext) then to restart with a empty list. I was thinking of correcting this myself : 1. Overriden DataMember property 2. When changed and in DesignMode 3. Loop all DataColumns in DataSet and add this to the GridBoundColumnCollection (heading = DataColumn.Caption) This works but the gridcolumns are not serialized on the form. Any suggestions ?

Administrator [Syncfusion]
Replied On October 25, 2005 05:07 PM UTC

If you do not explicitly populate GridBoundColumns, then you can use the grid.Binder.internalColumns collections to set properties, etc. But if you want to remove columns at runtime, you can use code like this: GriBoundColumnsCollection gbcc = this.grid.Binder.InternalColumns.Clone() as GriBoundColumnsCollection; //remove/add GridBoundColumns to gbcc. //then set them to be the used by the grid. grid.GridBoundColumns = gbcc; grid.Binder.InitializeColumns();

Krijn Michiels
Replied On October 25, 2005 06:33 PM UTC

Thanks, but how can I populate gridcolumns at runtime through an inherited databoundgrid ? We use the datacolumn.caption field to store our column description.

Administrator [Syncfusion]
Replied On October 25, 2005 07:05 PM UTC

I am not sure I understand. Why can''t you add a method named PopulateGridBoundColumns to the derived grid, and call that from the Load event of whatever form or usercontrol hosts the derived grid?

Krijn Michiels
Replied On October 25, 2005 09:21 PM UTC

Having (very) much coding to do and lots of grids I don''t think that I want to click thousands of times on gridboundcolumns -> add -> change header text (already have this in DataColumn.Caption) -> ... Code I''m struggling with : Sub OnDataMemberChanged() If not DesignMode then Exit Sub gridBoundColumns.Clear() For each dc as DataColumn in Ctype(DataSource,DataSet).Tables(DataMember) Dim column as new GridBoundColumn column.MappingName = dc.ColumnName column.HeaderText = dc.Caption gridBoundColumns.Add(column) ''... Next The changed collection gridBoundColumns is not serialized in the parent form. Guess it has something to do with the PropertyDescriptor.

Administrator [Syncfusion]
Replied On October 25, 2005 10:13 PM UTC

If what you want to do is to just display teh caption text as the header text for all columns, then the simplest thing to do is to handleModel.QueryCellInfo and swap the text at that point. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GDBG_VB_43760bfd.zip


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