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.

GridDataBoundGrid Inheritance Designer issue

Thread ID:

Created:

Updated:

Platform:

Replies:

36275 Oct 25,2005 01:01 PM Oct 25,2005 06:13 PM Windows Forms 5
loading
Tags: GridControl
Krijn Michiels
Asked On October 25, 2005 01:01 PM

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 01:07 PM

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 02:33 PM

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 03:05 PM

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 05:21 PM

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 06:13 PM

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

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.

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.

;