locked
Dynamic Data Filtering RRS feed

  • Question

  • User323304077 posted

    I'm still grasping the Dynamic Data functionality and had a question on the filtering.  In my table I keep track of a yes/no or true/false status (bit) and I want my users to be able to say yes, no, and all like the drop downs.  It seems as though this bit is rendering as a checkbox and my users cannot view all the records.  Any ideas?

    The field I am referencing is IsClosed.

     

                <asp:DynamicFilterForm ID="DynamicFilterForm1" runat="server" 
                    DataSourceID="GridDataSource" >
                    <filtertemplate>
                        <div>
                        </div>
                        <div>
                            <table>
                                <tr>
                                    <td>
                                        <asp:Label runat="server">Number:</asp:Label>
                                    </td>
                                    <td align="left">
                                        <asp:DynamicFilterControl runat="server" DataField="Number" />
                                    </td>
    
                                    <td>
                                        <asp:Label runat="server">Code:</asp:Label>
                                    </td>
                                    <td align="left">
                                        <asp:DynamicFilterControl runat="server" DataField="Code" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label runat="server">Closed:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:DynamicFilterControl runat="server" DataField="IsClosed" />
                                    </td>
                                    <td>
                                        <asp:Label runat="server">Status:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:DynamicFilterControl runat="server" DataField="Status" />
                                    </td>
                                    <td>
                                        <asp:Label runat="server">Type:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:DynamicFilterControl runat="server" DataField="Type" />
                                    </td>
                                    <td>
                                        <asp:Label runat="server">Error:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:DynamicFilterControl runat="server" DataField="Error" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:LinkButton ID="SearchButton" runat="server" CommandName="Search" 
                                            Text="Search" onclick="SearchButton_Click"  />
                                    </td>
                                    <td> 
                                        <asp:LinkButton ID="ClearButton" runat="server" CommandName="Clear" 
                                            Text="Clear" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </filtertemplate>
                </asp:DynamicFilterForm>
     
    Monday, December 15, 2008 12:13 PM

All replies

  • User600176218 posted

    Like all things in .NET, there are a number of ways you can do this.  IMHO, the best way to do this would be to create a field template, which you would apply to either this specific field, or all bit fields, depending on the needs of your application.

    There is some information at http://www.polymorphicpodcast.com/shows/ddintro/ (a podcast with a screencast and a sample project, but remember this was made on a beta version and may not be exactly the same as what you're working with), as well as http://rachelappel.com/asp-net-dynamic-data/custom-field-templates-in-asp-net-dynamic-data/ and http://msdn.microsoft.com/en-us/library/cc488523.aspx.

    Monday, December 15, 2008 1:18 PM
  • User-797310475 posted

    Hi Russ,

    your question is refering to the Dynamic Data Filtering project which is a 3rd party project maintained by Josh Hayes. You might get a quicker response if you contact him directly through the project's CodePlex site or his blog.

    Monday, December 15, 2008 2:22 PM
  • User-1005219520 posted

    Hey Russ,

    The Filter Repeater control should handle your bit field correctly. It should default to "all" and have "true" and "false" in the drop down list. Can you try navigating to this table using the default dynamic data scaffolding? For example, using the northwind DB, I would navigate to the MyWebSite/Products/List.aspx page to see the product entity. The Discontinued property has a filter repeater for the page.

    Monday, December 15, 2008 2:45 PM
  • User1024101778 posted

    Russ,

    I am guessing the issue is that the boolean filter user control is always appending a IsClosed == true or IsClosed == false where criteria.  You need a third state where no criteria is specified.  I will work up an example and post it on my blog when I have it finished.

    Josh

    Monday, December 15, 2008 9:32 PM
  • User323304077 posted

    Thanks all for the info.  Josh you are correct.  I need the 3rd state to be handled.  I'm guessing a new control for booleans would help that has All, Yes, and No.  Just not sure how to code it.  Your help is much appreciated.

    Tuesday, December 16, 2008 6:18 PM