This question is locked. New answers and comments are not allowed.
Hi,
I've one column which is bound on an enum.
(Status is an enum)
The display is working great, I've a display template which transforms the enum into localized string.
But I've problem regarding the filtering:
1a. The list allowing me to indicate what has to be filtered on other column(Is equal to, Start with, contains, ...) is empty
1b. I would like to have just a list of my localized enums values(value is XYZ, value is not XYZ, value is XYZ or ZXY)
How should I do this?
Other almost related question: My grid is working with server binding. I saw that when I'm ordering filtering, I've things like that which comes in the url:
2a. But I need to understand: when is this read? Because I've the impression that IIS retrieve the total list of element, and then filter. Is there a way to avoid that the server retrieves the full set?
2b. Sometimes I need to filter all data of my web page to a certain status, is there a way to generate links which filters automatically these data?
I've one column which is bound on an enum.
columns.Bound(m => m.Status).Template(@<text><p><strong>@Html.DisplayFor(m => item.Status, "Status")</strong></p></text>).Title(LocalizationResources.Status);The display is working great, I've a display template which transforms the enum into localized string.
But I've problem regarding the filtering:
1a. The list allowing me to indicate what has to be filtered on other column(Is equal to, Start with, contains, ...) is empty
1b. I would like to have just a list of my localized enums values(value is XYZ, value is not XYZ, value is XYZ or ZXY)
How should I do this?
Other almost related question: My grid is working with server binding. I saw that when I'm ordering filtering, I've things like that which comes in the url:
?MyGrid-orderBy=FormatName-asc2a. But I need to understand: when is this read? Because I've the impression that IIS retrieve the total list of element, and then filter. Is there a way to avoid that the server retrieves the full set?
2b. Sometimes I need to filter all data of my web page to a certain status, is there a way to generate links which filters automatically these data?
9 Answers, 1 is accepted
0
Hello Julien,
Up to your questions:
All the best,
Petur Subev
the Telerik team
Up to your questions:
- Basically you should not have any problems using the filtering on the Enum property. For your convenience I attached a sample project which implements displaying and editing of a model with an Enum property. Could you please check it and see if it works in your case?
- You can generate hyperlinks that have the MyGrid-filterBy=somevalue in their URL.
- As for the Database querying question.I suppose your collections are IQueryable, so the query is executed when the data is needed(lazy loading). When applying different methods over the collection the so called Expression Tree is constructed (e.g. using Where,OrderBy etc.) which is not requesting the database server. You can search the internet to find more information how exactly the IQueryable collections work.
All the best,
Petur Subev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Julien
Top achievements
Rank 1
answered on 20 Feb 2012, 01:51 PM
Thank you for your response, I will try your project ASAP.
My collection aren't IQueryable, since I'm using provider which open & close connection to the database.
My collection aren't IQueryable, since I'm using provider which open & close connection to the database.
0
Julien
Top achievements
Rank 1
answered on 22 Feb 2012, 04:01 PM
Your project works.
I made you a project showing the problem.
The biggest thing is that i've a nullable enum. It seems that since it's a nullable object, I've this problem.
Here is the sample project: http://dl.dropbox.com/u/368403/Telerik/gridSample.zip
And more problematic, it doesn't seems to use the "Editor template", so I'm seing directly enum value and not its localized version(this problem is also showed in the project, if you remove the nullable of the enum, you will see "admin" instead of "Administrator").
And for my previous response?
I made you a project showing the problem.
The biggest thing is that i've a nullable enum. It seems that since it's a nullable object, I've this problem.
Here is the sample project: http://dl.dropbox.com/u/368403/Telerik/gridSample.zip
And more problematic, it doesn't seems to use the "Editor template", so I'm seing directly enum value and not its localized version(this problem is also showed in the project, if you remove the nullable of the enum, you will see "admin" instead of "Administrator").
And for my previous response?
0
Hi again Julien,
Thank you for drawing our attention to this issue. Fortunately we fixed the issue and the filter menu is now using the values from the enumeration to populate the DropDowns (except the empty value).
Please find the hotfix archive in the attached files.
Also I created a sample project which implements the complete scenario related with the the nullable enumeration.
I hope this helps.
Regards,
Petur Subev
the Telerik team
Thank you for drawing our attention to this issue. Fortunately we fixed the issue and the filter menu is now using the values from the enumeration to populate the DropDowns (except the empty value).
Please find the hotfix archive in the attached files.
Also I created a sample project which implements the complete scenario related with the the nullable enumeration.
I hope this helps.
Regards,
Petur Subev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Julien
Top achievements
Rank 1
answered on 27 Feb 2012, 01:54 PM
Thank you for the fix.
It seems to work now.
But it doesn't resolve my second problem: how to display a text for those enums? Because my enum are text like "ElementWithMultipleValidation" and there is now way I display that(and in addition I need to have a localized application, so I need to retrieve those element from one resx file.
How should I do that?
It seems to work now.
But it doesn't resolve my second problem: how to display a text for those enums? Because my enum are text like "ElementWithMultipleValidation" and there is now way I display that(and in addition I need to have a localized application, so I need to retrieve those element from one resx file.
How should I do that?
0
Hello again Julien,
Adding a localization option for enum properties is already in our ToDo list and we plan to implement it in the near future. You can vote for it and track its progress here.
For now the only workaround I can think of is to customize the filter menu. As a base point you can use this Code Library article and extend it so it fits your needs.
All the best,
Petur Subev
the Telerik team
Adding a localization option for enum properties is already in our ToDo list and we plan to implement it in the near future. You can vote for it and track its progress here.
For now the only workaround I can think of is to customize the filter menu. As a base point you can use this Code Library article and extend it so it fits your needs.
All the best,
Petur Subev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Julien
Top achievements
Rank 1
answered on 29 Feb 2012, 09:56 AM
Yes, but even without localization, how can I display anything else than the enum.ToString()? I've a dictionary<myEnum,String> of text that I should display.
0
Julien
Top achievements
Rank 1
answered on 29 Feb 2012, 10:06 AM
And you really find acceptable to put a custom filter UI based on the title of the string? All my header are complex with Html, Localized, I'm not sure this is really relevant.
0
Hello Julien,
Petur Subev
the Telerik team
The only improvement to the work-around I can think of is to bind the click event based on the column index instead of the column title.
Regards,Petur Subev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.