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

DataBoundGrid - How to add column at runtime ?

Thread ID:

Created:

Updated:

Platform:

Replies:

70930 Jan 9,2008 11:59 AM UTC Jan 12,2008 04:52 AM UTC Windows Forms 3
loading
Tags: GridControl
Gen
Asked On January 9, 2008 11:59 AM UTC

I have a DataBound grid with dynamically created columns.
I need to add a column at runtime, but it does not appear.
Could you please advise?
Thanks.

Here is my code:
GridBoundColumn newCol = GridConfigurationHelper.createColumn();
GridHierarchyLevel hl = _grid.Binder.GetHierarchyLevel(0);
hl.GridBoundColumns.Add(newCol);

_grid.Binder.InitializeColumns();
_grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders);



haneefm [Syncfusion]
Replied On January 9, 2008 03:57 PM UTC

Hi Gen,

Please try this code snippet and let me know if this helps.

GridBoundColumn newCol = GridConfigurationHelper.createColumn();
GridHierarchyLevel hl = _grid.Binder.GetHierarchyLevel(0);
hl.InternalColumns.Add(newCol);
GridBoundColumnsCollection columns = hl.InternalColumns.Clone() as GridBoundColumnsCollection;
_grid.GridBoundColumns = columns;

Best regards,
Haneef


Gen
Replied On January 11, 2008 04:15 PM UTC


Thank you,
the problem is solved!

>Hi Gen,

Please try this code snippet and let me know if this helps.

GridBoundColumn newCol = GridConfigurationHelper.createColumn();
GridHierarchyLevel hl = _grid.Binder.GetHierarchyLevel(0);
hl.InternalColumns.Add(newCol);
GridBoundColumnsCollection columns = hl.InternalColumns.Clone() as GridBoundColumnsCollection;
_grid.GridBoundColumns = columns;

Best regards,
Haneef




Jisha Joy [Syncfusion]
Replied On January 12, 2008 04:52 AM UTC

Hi Gen,

Thank you for your update.

Regards,
Jisha



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

;