Using the ASP.NET Dynamic Data features introduced by the .NET Framework SP1 on my new project( a short intensive XP'ish, prototyping),  I was impressed by the fact that in two days I had all entities up and running in a data-entry application.
So I had something to show my client and the future users. They told me what they liked and how they felt the application should be working.
The first thing was that they wanted to search. Not only Filter (what is made possible out-of-the-box), but search, to my surprise this was not possible!

I went to www.asp.net/dynamicdata and opened the forum. I asked for the functionality. Scott Hunter, the PM on Dynamic Data answered my question an gave me the following url: http://www.codeplex.com/DynamicDataFiltering.
Josh Heyse from Catalyst Software Solutions is responible for this release. It is a dll that holds a DynamicLinqDataSource, DynamicFilterControl and the DynamicFilterForm. You just put it on the page by dragging and dropping.
When we drop the control on the page in the top of the page the following declaration is placed, so the page knows where the dll is containing the control:

   1:  <%@ Register Assembly="Catalyst.Web.DynamicData" Namespace="Catalyst.Web.DynamicData" TagPrefix="search" %>


Listing 1: Register Assembly

In the DynamicLinqDataSource you specify the

  • ContextTypeName (Linq to SQL or Entity Framework Datacontext Typename)
  • TableName (Name of the Table which contains the data you want to show on the page)
   1:  <search:DynamicLinqDataSource ID="GridDataSource" 
   2:                                ContextTypeName="Avanade.Data.MambooDataContext" 
   3:                                TableName="Products" 
   4:                                runat="server" >
   5:  </search:DynamicLinqDataSource>

Listing 2: DynamicLinqDataSource

In the FilterTemplate that is a child of the DynamicFilterForm you put the DynamicFilterControl, the DynamicFilterForm functionally acts like a form tag in HTML. The FilterTemplate, is like the ContentTemplate for AJAX;s UpdatePanel or ItemTemplate for GridView.
In the properties of the DynamicFilterControl we declare the DataField (Field belonging to the Table specified in the TableName of the DynamicLinqDataSource) and the FilterMode (Contains, Equals, MultiSelect, Range)

   1:  <search:DynamicFilterForm DataSourceID="GridDataSource" runat="Server" ID="DynamicFilterForm2">
   2:      <FilterTemplate>
   3:   
   4:          <asp:Label  ID="FilterTextLabel" 
   5:                      runat="server" 
   6:                      Text="NHL nummer"> 
   7:          </asp:Label>
   8:   
   9:          <search:DynamicFilterControl ID="DynamicFilterControl1" 
  10:                                       DataField="ProductName" 
  11:                                       FilterMode="Contains" 
  12:                                       Cssclass=""
  13:                                       runat="server">
  14:          </search:DynamicFilterControl>
  15:    
  16:      </FilterTemplate>
  17:  </search:DynamicFilterForm>

Listing 3: DynamicFilterform containing DynamicFilterControl

Now the user can enter the searchterm ´Dynam´ and find the product ´ASP.NET Dynamic Data´.

Henry cordes
My thoughts exactly...


Comments (7) -

Spin | Reply

11/02/2009 21:54:07 #

but i wold like to enter "NET Data" and still find product ASP.NET Dynamic Data ... how can i do it

12/02/2009 00:39:46 #

Well, if i understand your question correctly (enter "NET Data" and finding "ASP.NET Dynamic Data"), if you follow the post that is exactly what it is describing.
Using the Filtermode="Contains" in the DynamicFiltercontrol from Catalyst.Web.DynamicData gives you exactly this functionality.

On CodePlex
www.codeplex.com/.../ProjectReleases.aspx
The ASP.NET Dynamic Data 4.0 Preview 2 consists of A new QueryExtender control, contained in the sample projects to simplify common data filtering operations. It supports a rich ASP.NET declarative query syntax that makes it easy to do things like search data for text or have filters based on ranges.
This Preview also contains the functionality you want.
The next release will support this and more search criteria like ranges (numbers and/or dates).

Hope this helps and you solve yor problem.

Good luck

Dan Johnson | Reply

25/04/2009 11:00:45 #

Good stuff, Henry.  I tried to get the searching working by reading the Codeplex site but that didn't really seem to explain the basics.  This got me up and running in no time.  Thanks a lot!

Dan

26/04/2009 00:23:00 #

Nice to hear Dan, good luck!

prasadrmarathe | Reply

12/08/2009 07:06:17 #

HI,
I tried a example the way you said,
but it gives me a eror called
"Unknown server tag 'searchLaughingynamicFilterControl'."

Can u please help me.

22/08/2009 19:53:43 #

Did you install and reference the dll you can download at: in http://www.codeplex.com/DynamicDataFiltering?

Min Singapore | Reply

19/10/2012 11:00:34 #

In my case , after implement it ,it gives me this error

"The field template folder '~/DynamicData/FilterTemplates/' does not exist"

I cant find Filters Folder in project.

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading