This is a migrated thread and some comments may be shown as answers.

RadGrid with undefined columns with FilterExpression

2 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 18 Jul 2012, 10:26 PM
I found it difficult to title this appropriately, but here's my problem, first with some background info.

1. I created a DataTable, gave it some columns, and populated it with data.
2. I then used a DataView to sort that data.
3. Finally I bound the DataView to a custom control inheriting from RadGrid.

I want to filter the resulting RadGrid rows to divide it up into subsets, but no matter what I try for my FilterExpression, nothing works. After stepping through my code in debug mode, I noticed the RadGrid.Columns.Count = 0, even though I have results and columns with headers as I defined in my DataTable. I suspect this is why my FilterExpression is not working, though I also don't understand how it could have zero columns, yet the Columns are rendering just fine, headers and all. I was under the impression that by Binding my data, the RadGrid would automatically inherit the Columns and their names, but apparently not. How then can FilterExpression even work as it should?

Thoughts? Suggestions?

2 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 23 Jul 2012, 01:40 PM
Hi Matthew,

Please note that if your columns are auto-generated, you could access them using the following collection - RadGrid1.MasterTableView.AutoGeneratedColumns or RadGrid1.MasterTableView.RenderColumns.

As for the filtering issue, could you please check out the following topics which describe handling Filter expressions and let me know about the result?
 Operating with the FilterExpression of Telerik RadGrid Manually
 Applying Default Filter on Initial Load

Actually, it is quite difficult to determine the exact cause of the problem without the mark-up of the project and the related code behind. It would be great if you open a support ticket and provide us a sample runnable application demonstrating your specific scenario. Thus, we will be able to further analyze the issue and provide a proper solution.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Matthew
Top achievements
Rank 1
answered on 23 Jul 2012, 04:54 PM
Hello Eyup,

I was forced to find another solution by further separating my functions and instead doing filtering on a DataTable.DefaultView, then bind the independent results to separate RadGrids. All my RadGrids are instantiated dynamically in the codebehind and added to a Placeholder control in the markup. I think the articles you posted may help some who find this question, so I'll go ahead and mark it answered, but I do not think it would have helped me in my situation. For the record, I am using AutoGenerateColumns, but it makes no sense to me why Telerik would decide to put these in a separate container than Columns. A column is a column as far as I see it.

Thanks,
Matthew
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Matthew
Top achievements
Rank 1
Share this question
or