From what I've found online it seems that Filters just appear when you create a dynamic data site. But that's not the case for me. I am using .net 4, vs 2010, and my site is based on Linq2SQL model. Everything works just fine except I dont see filters. Do
I needd to to do something special for filters to show on my table?
In my experience I have seen that this will only happen if your entities are properly joined by means of foreign keys ... try doing a littele reverse engineering with Northwind and you might see how it works
Navigation Properties (Foreign Key columns are hidden). Navigation Properties are the Data Models way of showing the Foreign Key relationship from your data base both Linq to SQL and Entity Framework have these but they are only there if you have them in
you Database.
Boolean filters
if you have niether of these in your model you will not get filters.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
Yes you czn have filters no poroblem just not the default automatically generated ones. have a look at my NuGet package here
Dynamic Data 15 Custom Filters you can add these usign the [FilterUIHint("FilterName")] Attribute see details
here
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
I did a NuGet on that package and all installed without a problem. I then set up the uihint like you say but still get nothing. Here's what I have:
I only added one field to test it:
[ScaffoldTable(true)]
public partial class ModelTable
{
[FilterUIHint("WhereDropdownList")]
public virtual int ModelTableField
{
get;
set;
}
}
My context is properly registerd as everything still works as before on the interface, it's just that I don;t get a filter showing up. I haven't tried a different kind of filter for that field, but i imagine these filter don;t care about type.
Yes it is .Net 4. But what I'm wondering now if if this works with my ORM generator Plinqo (codesmith.) Perhaps I should predefine this custom field in the dbml. Of couse that would defeat the purpose of adding a custom calculated column because I'd have
to recreate it every time the dbml was re-generated.
I'm going to try a new project without plinqo and use one of the the default options.
OK, so I think I see what the problem is. My partial table class is not being recognized, this is my model class to which I add the custom code, but this has to be part of the main table class assembly. And it's because the main part of the table object
class is defined in another project and partial classes can only be defined within the same project. This means that I cannot use Plinqo, or at least I cannot use the instance of plinqo defined in the data obeject of my solution. I would either need to have
a second plinqo generator in this new project or I would have to use the standard project template and generate my own orm thru linq to sql. :)
IAmTheWalrus
Member
31 Points
24 Posts
How to enable filters on dynamic data List page?
Dec 22, 2012 01:53 AM|LINK
From what I've found online it seems that Filters just appear when you create a dynamic data site. But that's not the case for me. I am using .net 4, vs 2010, and my site is based on Linq2SQL model. Everything works just fine except I dont see filters. Do I needd to to do something special for filters to show on my table?
klca
Member
509 Points
421 Posts
Re: How to enable filters on dynamic data List page?
Dec 22, 2012 04:08 AM|LINK
Hi,
In my experience I have seen that this will only happen if your entities are properly joined by means of foreign keys ... try doing a littele reverse engineering with Northwind and you might see how it works
Carlos N. Porras
(El Salvador)
sjnaughton
All-Star
27391 Points
5485 Posts
MVP
Re: How to enable filters on dynamic data List page?
Dec 22, 2012 10:28 AM|LINK
Hi IAmTheWalrus, the default filters are based on
if you have niether of these in your model you will not get filters.
Always seeking an elegant solution.
IAmTheWalrus
Member
31 Points
24 Posts
Re: How to enable filters on dynamic data List page?
Dec 22, 2012 11:35 AM|LINK
Thanks for your reply. The nature of my databse is such that there are no FK's, each table is an entity unto itself and does not link to any other.
Does this mean that I cannot have filters? Or that I must code the filtering myself?
sjnaughton
All-Star
27391 Points
5485 Posts
MVP
Re: How to enable filters on dynamic data List page?
Dec 22, 2012 03:41 PM|LINK
Yes you czn have filters no poroblem just not the default automatically generated ones. have a look at my NuGet package here Dynamic Data 15 Custom Filters you can add these usign the [FilterUIHint("FilterName")] Attribute see details here
Always seeking an elegant solution.
IAmTheWalrus
Member
31 Points
24 Posts
Re: How to enable filters on dynamic data List page?
Dec 24, 2012 01:21 PM|LINK
Thanks!
I did a NuGet on that package and all installed without a problem. I then set up the uihint like you say but still get nothing. Here's what I have:
I only added one field to test it:
[ScaffoldTable(true)] public partial class ModelTable { [FilterUIHint("WhereDropdownList")] public virtual int ModelTableField { get; set; } }My context is properly registerd as everything still works as before on the interface, it's just that I don;t get a filter showing up. I haven't tried a different kind of filter for that field, but i imagine these filter don;t care about type.
Thanks!
sjnaughton
All-Star
27391 Points
5485 Posts
MVP
Re: How to enable filters on dynamic data List page?
Dec 27, 2012 09:38 AM|LINK
Hi there, are you sure you are on a .Net 4 project as there are no custom filters in the default .Net 3.5 sproject.
Always seeking an elegant solution.
IAmTheWalrus
Member
31 Points
24 Posts
Re: How to enable filters on dynamic data List page?
Dec 27, 2012 01:34 PM|LINK
Yes it is .Net 4. But what I'm wondering now if if this works with my ORM generator Plinqo (codesmith.) Perhaps I should predefine this custom field in the dbml. Of couse that would defeat the purpose of adding a custom calculated column because I'd have to recreate it every time the dbml was re-generated.
I'm going to try a new project without plinqo and use one of the the default options.
IAmTheWalrus
Member
31 Points
24 Posts
Re: How to enable filters on dynamic data List page?
Dec 27, 2012 03:07 PM|LINK
OK, so I think I see what the problem is. My partial table class is not being recognized, this is my model class to which I add the custom code, but this has to be part of the main table class assembly. And it's because the main part of the table object class is defined in another project and partial classes can only be defined within the same project. This means that I cannot use Plinqo, or at least I cannot use the instance of plinqo defined in the data obeject of my solution. I would either need to have a second plinqo generator in this new project or I would have to use the standard project template and generate my own orm thru linq to sql. :)
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: How to enable filters on dynamic data List page?
Dec 28, 2012 12:35 AM|LINK
Hi,
Since your problem is found, so is your problem solved?
I come here to check and make a confirmation.