custom FilterTemplate

Apr 9, 2009 at 1:29 PM
Edited Apr 9, 2009 at 1:30 PM

I'm using DynamicFilterRepeater and it works well. What I'm unable to do is to tell which FilterTemplate *.ascx file should filter use. My metamodel code looks like this:

    private interface CompanyMetadata
[Filter(FilterMode = FilterControlMode.Contains)]
string name { get; set; }

I created in DynamicData\FilterTemplates folder files with name MyText_Contains.ascx  and .cs (which in fact are copy of original Text_Contains.asxc & cs) and modified some stuff which I wanted to change. But problem is that it allways runs Text_Contains.ascx and never MyText_Contains.ascx.

What can be wrong? I'm I missing some name convention ? (I tryied also [UIHint("MyText_Contains")] unsucessfully.)

I use latest *.dll built myself from source code 45383 (Dec 31 2008 at 12:26 AM  - Added UIHint property to FilterAttribute & use UIHint property to determine default filter rendered via DynamicFilterRepeater)
Apr 9, 2009 at 2:00 PM
The attributes you have are correct. The UIHint & FilterMode follow the same convention as the standard UI controls in DynamicData.  So it will append "_Contains" to "MyText".  Are you getting the DispalyName showing up correctly?  I wonder if it might be an issue with the MetadataType registration?

Some more source code would help me figure out what is going on.

Apr 9, 2009 at 3:09 PM
Edited Apr 9, 2009 at 3:10 PM
Yes, DisplayName works and filtering runs well, but only with default FilterTemplates. Nothing special in aspx page:

<asp:DynamicFilterRepeater ID="DynamicFilterRepeater1" runat="server" DataSourceID="GridDataSource">
                        <b><asp:Label ID="Label1" runat="server" Text='<%# Eval("DisplayName") %>' /></b>
                        <asp:DynamicFilterControl ID="DynamicFilter" runat="server" />
                        <asp:LinkButton ID="SearchButton0" runat="server" CommandName="Search" Text="Search it" />
                        <asp:LinkButton ID="ClearButton0" runat="server" CommandName="Clear" Text="X" />

           <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource"
                AllowPaging="True" AllowSorting="True" CssClass="gridview"
                AutoGenerateColumns="False" PageSize="20">
            <asp:DynamicLinqDataSource ID="GridDataSource" runat="server"

MyText_Contains.ascx.cs file:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Catalyst.Web.DynamicData;

public partial class MyText_Contains : Catalyst.Web.DynamicData.LikeFilterUserControlBase
public override LikeExpressionParameter.LikeType Like
return LikeExpressionParameter.LikeType.Contains;
set { }

public override string Value
return TextBox1.Text;
TextBox1.Text = value;
MyText_Contains.ascx file:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyText_Contains.ascx.cs" Inherits="MyText_Contains" %>
<asp:TextBox ID="TextBox1" runat="server" BackColor="Aqua"></asp:TextBox>

So you see there is only BackColor attribute added.  Also I'm running it as web site not web application, so there is no namespace stuff and no need to full classpath in Inherits. I also removed namespace stuff from standard filter templates and they run just fine.
Apr 15, 2009 at 12:18 PM
Still no ideas what can be wrong ?