Dynamic Data Filter: Foreign key doent map to ForeignKey template
===

 i have a 2 sqltable `EmpInf` with EmpId, EmpName, Salary and `Foreign key DeptNumber` and a 2nd table `Dept` with `primary key DeptNo` and `DeptName`

i have a Dynamic Data Control : `Data Manager`, `Linqtosql` and a gridview, such as

    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" >
    <DataControls>
    <asp:DataControlReference ControlID="GridView1" />
    </DataControls>
    </asp:DynamicDataManager>
    
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
        ContextTypeName="filtercontrol1.DataClasses1DataContext"  TableName="EmpInfs" 
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName="">
    </asp:LinqDataSource>
    
    <asp:GridView ID="GridView1" runat="server" DataSourceID="LinqDataSource1" 
        AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" 
        DataKeyNames="EmpId">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ShowSelectButton="True" />
            <asp:BoundField DataField="EmpId" HeaderText="EmpId" ReadOnly="True" 
                SortExpression="EmpId" />
            <asp:BoundField DataField="EmpName" HeaderText="EmpName" 
                SortExpression="EmpName" />
            <asp:BoundField DataField="Salary" HeaderText="Salary" 
                SortExpression="Salary" />
            <asp:BoundField DataField="DeptNumber" HeaderText="DeptNumber" 
                SortExpression="DeptNumber"  />
        </Columns>
    </asp:GridView>
    <br />

i am trying to filter the `gridview` using a `Dynamic data filter` such as 

    <asp:DynamicFilter ID="DynamicFilter1" runat="server" DataField="DeptNUmber" FilterUIHint="ForeignKey">
    </asp:DynamicFilter>
    
    <asp:QueryExtender ID="QueryExtender1" 
        TargetControlID="LinqDataSource1" runat="server">
        <asp:DynamicFilterExpression ControlID="DynamicFilter1" />
    </asp:QueryExtender>

basically i have assigned a `foreign key DeptNumber` in a DynamicfilterTemplate and assigned a `FilterUinhint as Foreign`. but during runtime it throws an exception

    Unable to cast object of type 'System.Web.DynamicData.MetaColumn' to type 'System.Web.DynamicData.MetaForeignKeyColumn'.


    namespace filtercontrol1
    {
        public partial class ForeignKeyFilter : System.Web.DynamicData.QueryableFilterUserControl
        {
            private const string NullValueString = "[null]";
            private new MetaForeignKeyColumn Column
            {
                get
                {
                    return (MetaForeignKeyColumn)base.Column; // it throws an exception here.
                }
            }

thanks for any assistance. 

