When a grid contains a GridDropDownColumn to display text linked to a value of a field, the Group feature only shows the value of the field and not the related text. The documentation says that showing the value of the field is the default and additional comments on the forum suggest using GroupByExpression to permit showing the text field. However, I can not get this to work. I am using two EntityDataSources, one for the grid datasource and a second to host the dropdown values. I would like to implement a solution but if the current RadGrid can already pull the text from the second datasource to show in the grid, it should be automatically possible to show the same text when using the Group function.
Any suggestions are welcome.
Any suggestions are welcome.
5 Answers, 1 is accepted
0
Hello Walter,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Attached is a sample demonstrating your scenario. Could you modify it so that the issue you have encountered is reproduced and get back with further information.
Thanks in advance.
Greetings,Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ceramist
Top achievements
Rank 1
answered on 23 Feb 2010, 03:25 PM
Thank you very much for creating a exact image of my problem within a well defined example. Your solution works for resolving the group heading. Now when grouping against a drop down column, the heading says the text instead of the value of the field in the lookup table. However, this solution does not permit inserting or updating information to the database. There is an error due to the inability to look up the related key information.
When I examine the trace during the GroupChanging event of the RadGrid, I can see that it creates a groupby expression of "Categories.CategoryName GROUP BY Categories.CategoryName". I had tried to force using the CategoryID for the drop down datafield and then use a groupby expression of "Categories.CategoryID GROUP BY Categories.CategoryName" but that does not work either. This generates as "Field Categories.CategoryName not found in the source table."
I will try to emulate the problem using an alternative to the Entity Framework, using another datasource to identify detect if the problem persists. This might point out if the RadGrid needs some assistance in finding the right text field or if the Entity Framework isnt permiting some type of communication.
When I examine the trace during the GroupChanging event of the RadGrid, I can see that it creates a groupby expression of "Categories.CategoryName GROUP BY Categories.CategoryName". I had tried to force using the CategoryID for the drop down datafield and then use a groupby expression of "Categories.CategoryID GROUP BY Categories.CategoryName" but that does not work either. This generates as "Field Categories.CategoryName not found in the source table."
I will try to emulate the problem using an alternative to the Entity Framework, using another datasource to identify detect if the problem persists. This might point out if the RadGrid needs some assistance in finding the right text field or if the Entity Framework isnt permiting some type of communication.
0
Hello Walter,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
My sample, indeed, works only for data display scenarios. If you need, however, to edit the drop-down field then you need to bind the drop-down column to it which will make the group headers display the value not the text data. Circumventing this problem is not as simple since you need to do it manually.
Attached is another sample that demonstrates how to achieve this. I hope it helps.
Best wishes,Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Bogdan Cucosel
Top achievements
Rank 1
answered on 04 Mar 2010, 04:18 PM
Hello,
The solution you propose only displays in the groupItem the text value instead of the id value (int , guid or wathever the id may be).
The problem is that the user actualy sees the text value not the id , and , when sorting the group, it is confusing (instead of groups being alphabetically sorted they are sorted according to the rules of the id).
I also tried setting the SortExpression of the column but that does not work either.
Also, overriding the GetDefaultGroupByExpression to return something like "Author.Name Group By Author.Name" instead of "Author.Id GroupBy Author.Id" fails in the GridDataSetHelper.CreateGroupByTable method, as the SourceTable has the column "Author.Id" but not "Author.Name".
Could you please indicate a better approach for grouping corectly a GridDropDownColumn ?
Thank you
The solution you propose only displays in the groupItem the text value instead of the id value (int , guid or wathever the id may be).
The problem is that the user actualy sees the text value not the id , and , when sorting the group, it is confusing (instead of groups being alphabetically sorted they are sorted according to the rules of the id).
I also tried setting the SortExpression of the column but that does not work either.
Also, overriding the GetDefaultGroupByExpression to return something like "Author.Name Group By Author.Name" instead of "Author.Id GroupBy Author.Id" fails in the GridDataSetHelper.CreateGroupByTable method, as the SourceTable has the column "Author.Id" but not "Author.Name".
Could you please indicate a better approach for grouping corectly a GridDropDownColumn ?
Thank you
0
Hello Bogdan,
Thanks for the feedback.
If you need to sort on a foreign key column, you won't be able to use the EntityDataSource but do both the binding and the database operations manually.
All the best,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks for the feedback.
If you need to sort on a foreign key column, you won't be able to use the EntityDataSource but do both the binding and the database operations manually.
All the best,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.