ASP.NET Forums/General ASP.NET/Data Scaffolding using ASP.NET Dynamic Data/Customizing Filters and Field Templates

Customizing Filters and Field Templates [Answered]RSS

21 replies

Last post Nov 10, 2010 08:52 AM by sjnaughton

Custom Field Templates Cascad FieldTemplate Custom Filters Dynamic Data 4

See my blog C# Bits | Twitter @sjnaughton
Always seeking an elegant solution.
  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Oct 25, 2010 06:13 AM|PeterSkellern|LINK

    Thank you.

    Quick question:
    I took a glimpse of your blog, which by the way looks amazing, and I would like to know that if I were to control this kind of process, let's say for 15 entities, do I have to go through this process of Hierarchical Filter for each one of them?

  • sjnaughton sjnaughton

    All-Star

    17915 Points

    5679 Posts

    MVP

    Re: Customizing Filters and Field Templates

    Oct 25, 2010 07:08 AM|sjnaughton|LINK

    if that is how many are in a single hierarchy as the each column may have several relationships.

    Dynamic Data 4 Cascading Field Template Cascading Filter Templates

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Oct 25, 2010 07:40 AM|PeterSkellern|LINK

    Thank you, let's see if I got it right. If my sequence is: company -> warehouse -> patio -> furniture 

    1) I don't need to customize company because is the uppermost level of the hierarchy

    2) For warehouse I will have to create a customized hierarchy depending on company (1 extra DropDownList)

    3) For patio I will have to create a customized hierarchy depending on company and on warehouse (2 extra DropDownLists)

    4) For furniture I will have to create a customized hierarchy depending on company and on warehouse and on patio (3 extra DropDownLists)

    Am I correct?

  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Oct 25, 2010 07:49 AM|PeterSkellern|LINK

    Thank you.

    I have to add that I still need to put all of this inside my customized control or should I point to a different direction?

  • sjnaughton sjnaughton

    All-Star

    17915 Points

    5679 Posts

    MVP

    Re: Customizing Filters and Field Templates

    Oct 25, 2010 09:01 AM|sjnaughton|LINK

    With my sample all you do is add the filter/field template and the assembly to you app, then add metadata

    [FilterUIHint("CascadeHierarchical")]
    [UIHint("CascadeHierarchical")]
    [CascadeHierarchical("Patio", "Warehouse", "Company")]
    public Object Furniture { get; set; }

    This metadata configures the Furniture column to use the Patio, Warehouse and Company columns as it's parents see the article previously mentioned.

    if your tables are not configured like diagrams 2 and 3 in the article

    Figure 2

    Figure 3

    but like figure 2

    Figure 2

    Then you will need to look at the older articles here Cascading Filters – for Dynamic Data v1.0

    Dynamic Data 4 Cascading Field Template Cascading Filter Templates

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • klca klca

    Member

    242 Points

    480 Posts

    Re: Customizing Filters and Field Templates

    Oct 25, 2010 03:10 PM|klca|LINK

    Re: Customizing Filters and Field Templates

  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Nov 06, 2010 10:00 AM|PeterSkellern|LINK

    Is there a clean version of your supporting dll files? The samples seem to have code from a Vehicles example. Thank you.

  • sjnaughton sjnaughton

    All-Star

    17915 Points

    5679 Posts

    MVP

    Re: Customizing Filters and Field Templates

    Nov 06, 2010 10:42 AM|sjnaughton|LINK

    Hi Peter,  you just need to copy the class libraries and the field template and filters to you own project.

    Dynamic Data 4

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Nov 07, 2010 11:47 AM|PeterSkellern|LINK

    Thank you. I did it but now I am having the following problem:

    Error 1 Could not load type 'CascadeHierarchicalFieldTemplate.CascadeHierarchical_EditField'. 
    C:\Developments\CSharp\NotAClueWay\DynamicData\FieldTemplates\CascadeHierarchical_Edit.ascx'

    I have created two folders under App_Code: DataAnnotations and DynamicData.

    Under App_Code/DataAnnotations I have a folder Attributes containing the class CascadeHierarchicalAttribute.cs. I also have a folder ExtensionMethods containing AttributeExtensionMethods.cs.

    In the folder App_Code/DynamicData I have the class HierachicalListControl.cs and two folders ExtensionMethods and Helpers.

    ExtensionMethods has CascadeHierarchicalExtensions.cs, IQueriableExtensionMethods.cs and MetaModelExtensions.cs.
    Helpers has ExpressionHelper.cs in it.

    I have copied CascadeHierarchical_Edit.ascx and CascadeHierarchical.ascx under the natural DynamicData/FieldTemplates folder. I have also copied CascadeHierarchical1.ascx and CascadeHierarchical.ascx under DynamicData/Filters

    Namespaces seem to be correct so I don't understand why this problem is arising.

    Moreover, If I do it the other way, using your dlls, then I can't access the break point in debug mode  which issues me a warning that the source code no longer matches the original one. Of course that I have made some changes that I need and if I choose debug mode running  without the "Require source files to exactly match the original version" option then I have the break points hit but then it wouldn't recognize the changes I have made. It passes over the original code only. Can you help me, please?

  • sjnaughton sjnaughton

    All-Star

    17915 Points

    5679 Posts

    MVP

    Re: Customizing Filters and Field Templates

    Nov 07, 2010 01:09 PM|sjnaughton|LINK

    PeterSkellern

    Error 1 Could not load type 'CascadeHierarchicalFieldTemplate.CascadeHierarchical_EditField'. 
     

    Suggests there is still a namespace issue, I suspect you are using a websit enot web application project? re App_Code folder.

    Dynamic Data 4

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Nov 07, 2010 01:23 PM|PeterSkellern|LINK

    Thank you. That is correct. I am working a web site not a project. Any difference?

  • sjnaughton sjnaughton

    All-Star

    17915 Points

    5679 Posts

    MVP

    Re: Customizing Filters and Field Templates

    Nov 07, 2010 02:19 PM|sjnaughton|LINK

    In WAP (Web Application Project) you can have classes anywhere but in WSP (Web Site Project) they can only be in App_Code folder, I generally keep all my classes in seperate class libraries you will notice namespaces starting with NotAClue every where in my samples you will need to remove them in you are using the classes fromt he App_code folder and all my template are also expecting those namespaces.

    Dynamic Data 4

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Nov 08, 2010 01:25 PM|PeterSkellern|LINK

    Thank you. I have removed all references to NotAClue. I put all your classes under App_Code with a namespace = "cascade".

    Trying to make things easier I copied just one of the custom controls, CustomCascadeHierarchical.ascx, to the DynamicData/FieldTemplates folder. Dind't work so I rather put it under the App_code folder too but I still got the message: Error 1 Could not load type 'CustomCascadeHierarchicalField'

    What am I missing here? After 6 hours I feel with NotAClue about this

  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Nov 09, 2010 02:49 AM|PeterSkellern|LINK

    Thank you. Don't know how to create alerts as to make people who are helping me to check and follow my newer posts. I will greatly appreciate any help with the namespacing issue on Steve's hierarchical filters implementation. BTW, how can you post pictures here?

  • sjnaughton sjnaughton

    All-Star

    17915 Points

    5679 Posts

    MVP

    Re: Customizing Filters and Field Templates

    Nov 09, 2010 04:05 AM|sjnaughton|LINK

    Hi Peter, I will see if I have time today to port to WSP for you .

    Dynamic Data 4

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • PeterSkellern PeterSkeller...

    Member

    76 Points

    151 Posts

    Re: Customizing Filters and Field Templates

    Nov 10, 2010 07:16 AM|PeterSkellern|LINK

    Thank you and please do it at your best convenience but if it were sooner it will be much better.

  • sjnaughton sjnaughton

    All-Star

    17915 Points

    5679 Posts

    MVP

    Re: Customizing Filters and Field Templates

    Nov 10, 2010 08:52 AM|sjnaughton|LINK

    Hi Peter, here is the sample with a WSP added and working here http://cid-96845e7b0fac1eed.office.live.com/self.aspx/Public/CascadeHierarchicalFieldTemplate%20-%202010-11-10a.zip

    on my skydrive.

    Dynamic Data 4 Cascading Field Template Cascading Filter Templates

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • ‹ Previous Thread|Next Thread ›