Hi
We have an Aspxgrid that is bound to a Sql Datasource. Some columns are defined in the aspx markup while other columns are added in the DataBinding event as they are unknown at design time. Below is how we are adding the columns
Visual BasicPrivate Sub grid_DataBinding(sender As Object, e As EventArgs) Handles grid.DataBinding
grid.DataSource = dsWip
Dim dw As DataView = CType(dsWip.Select(DataSourceSelectArguments.Empty), DataView)
If dw IsNot Nothing Then
Dim dataTable As DataTable = dw.ToTable()
If dataTable.Rows.Count > 0 Then
' Loop through the columns and add dynamic columns
For Each column As DataColumn In dataTable.Columns
' Skip the standard columns
If IsNotInColumnList(column.ColumnName) Then
Dim CKcolumn As New DevExpress.Web.GridViewDataCheckColumn()
CKcolumn.ReadOnly = True
CKcolumn.FieldName = column.ColumnName
CKcolumn.Caption = column.ColumnName
CKcolumn.PropertiesCheckEdit.ConvertEmptyStringToNull = True
CKcolumn.PropertiesCheckEdit.NullDisplayText = "No"
CKcolumn.Settings.AllowHeaderFilter = DevExpress.Utils.DefaultBoolean.False
CKcolumn.Settings.ShowFilterRowMenu = DevExpress.Utils.DefaultBoolean.False
CKcolumn.Settings.AllowAutoFilter = DevExpress.Utils.DefaultBoolean.False
CKcolumn.Settings.ShowInFilterControl = DevExpress.Utils.DefaultBoolean.False
grid.Columns.Add(CKcolumn)
End If
Next
End If
End If
End Sub
This works fine, but I am having 2 problems as a result. First when a user attempts to hide one of the dynamically added columns via the "Customization dialog" the columns are not added. Columns defined in the aspx page will hide, but not those added dynamically.
Secondly, even though SettingsCookies-Enabled="True", changes in column widths are not being persisted.
Any guidance would be appreciated.
HiAlexander
That did the trick. Thanks for the quick response.
Peter