I am dynamically building a grid control on the PAGE_LOAD event. Column headers and data are all bound on the fly, nothing is static. I am using the the Filter Icons and have set AllowMultiColumnSorting = "TRUE".
I am able to sort only by one column. When I try to enter data into a second field to sort by a second field, my first sort value goes away. What is needed to keep these sort values?
Here is some code to help you understand how my grid is built.
All help is greatly appreciated!
I am able to sort only by one column. When I try to enter data into a second field to sort by a second field, my first sort value goes away. What is needed to keep these sort values?
Here is some code to help you understand how my grid is built.
All help is greatly appreciated!
Dim RadGrid1 As RadGrid = New RadGrid
RadGrid1.ID = "RadGrid1"
RadGrid1.Width = Unit.Percentage(100)
RadGrid1.PageSize = 5
RadGrid1.AllowPaging = True
RadGrid1.AllowSorting = True
RadGrid1.AllowFilteringByColumn = True
RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
RadGrid1.PagerStyle.Position = GridPagerPosition.TopAndBottom
RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom
RadGrid1.MasterTableView.CommandItemStyle.BackColor = Color.LightGray
RadGrid1.MasterTableView.CommandItemStyle.ForeColor = Color.Black
RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = False
RadGrid1.MasterTableView.CommandItemSettings.ShowExportToPdfButton = True
RadGrid1.MasterTableView.CommandItemSettings.ShowExportToExcelButton = True
RadGrid1.MasterTableView.AllowFilteringByColumn = True
RadGrid1.ExportSettings.ExportOnlyData = True
RadGrid1.AutoGenerateColumns = False
RadGrid1.Skin = "MetroTouch"
RadGrid1.BorderStyle = BorderStyle.None
RadGrid1.MasterTableView.HeaderStyle.ForeColor = Color.White
RadGrid1.MasterTableView.EnableColumnsViewState = False
RadGrid1.MasterTableView.PageSize = 15
RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace
RadGrid1.MasterTableView.AllowMultiColumnSorting = True
Dim tblStopData As DataTable = New DataTable
Dim cmd As SqlCommand = New SqlCommand("SP_STORED_PROC", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim adapter As New SqlDataAdapter(cmd)
adapter.SelectCommand.CommandTimeout = 300
adapter.Fill(tblStopData)
Dim name(tblStopData.Columns.Count) As String
Dim i As Integer = 0
For Each column As DataColumn In tblStopData.Columns
Dim boundColumn As GridBoundColumn = New GridBoundColumn
RadGrid1.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = column.ColumnName
boundColumn.HeaderText = column.ColumnName
'boundColumn.AndCurrentFilterFunction = GridKnownFunction.Contains
boundColumn.ShowFilterIcon = True
Next
RadGrid1.DataSource = tblStopData
RadGrid1.Rebind()