locked
How to enable filters on dynamic data List page? RRS feed

  • Question

  • User1625218257 posted

    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?

    Friday, December 21, 2012 9:53 PM

Answers

  • User1625218257 posted

    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. :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 27, 2012 11:07 AM

All replies

  • User-326746839 posted

    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) 

    Saturday, December 22, 2012 12:08 AM
  • User-330204900 posted

    Hi IAmTheWalrus, the default filters are based on

    1. 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.
    2. Boolean filters

    if you have niether of these in your model you will not get filters.

    Saturday, December 22, 2012 6:28 AM
  • User1625218257 posted

    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?

    Saturday, December 22, 2012 7:35 AM
  • User-330204900 posted

    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

    Saturday, December 22, 2012 11:41 AM
  • User1625218257 posted

    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!

    Monday, December 24, 2012 9:21 AM
  • User-330204900 posted

    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.

    Thursday, December 27, 2012 5:38 AM
  • User1625218257 posted

    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.

    Thursday, December 27, 2012 9:34 AM
  • User1625218257 posted

    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. :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 27, 2012 11:07 AM
  • User3866881 posted

    Hi,

    Since your problem is found, so is your problem solved?

    I come here to check and make a confirmation.

    Thursday, December 27, 2012 8:35 PM
  • User1625218257 posted

    I have to do a workaround.

    Thursday, December 27, 2012 9:34 PM