Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
3672 | Apr 1,2003 11:48 AM UTC | Apr 1,2003 03:05 PM UTC | WinForms | 2 |
![]() |
Tags: GridControl |
//set the datasource to generate the internal columns this.gridDataBoundGrid1.DataSource = dt; //modify the internal columns somehow... GridBoundColumn gbc = this.gridDataBoundGrid1.Binder.InternalColumns[1]; gbc.HeaderText = "Column 1"; //save the internal columns int count = this.gridDataBoundGrid1.Binder.InternalColumns.Count; GridBoundColumn[] gbcs = new GridBoundColumn[count]; for(int i = 0; i < count; ++i) gbcs[i] = this.gridDataBoundGrid1.Binder.InternalColumns[i]; //add the save columns as GridBoundColumns this.gridDataBoundGrid1.GridBoundColumns.AddRange(gbcs);You have to save the internal columns to be able to later use them as the first time a column is added to GridBoundColumns, the InternalColumns are zapped. Attached is a little sample that rebinds the grid to a table.Clone when you press the button without losing the title set in teh grid bound column.
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.
This page will automatically be redirected to the sign-in page in 10 seconds.