p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   Search Function and User Controls (http://p2p.wrox.com/showthread.php?t=51879)

hpox December 22nd, 2006 02:27 PM

Search Function and User Controls
Hi (first post here),

I implemented a search functionality to a website. That website was developed using a 3-layers architecture as described in Bellinaso's Problem - Design - Solution.

I use a custom control ProductListings.ascx to show the results. Basically, the Recherche class take a string and return a List<Product>. Then the GridView use that List<Product> to show all the results found by the search.



    ID="GridView1" runat="server"

What we want to add is a way to add more information than only the results via a GridView. For example, we want to print the keywords that were used to search for these products, the time taken to process the search, a special message when there is no product.

The Recherche class does more than just pass the search string to the DAL. It will take a string such as "le ski de fond", cut it into 4 words and remove "le" and "de" because they're article. So it will pass ["ski", "fond"]. I want to print that on the result page so the user knows "le" and "de" were not taken into account.

My idea was to add properties (keywords, timeTaken) inside the Recherche object that can be set during the algorithms. Then inside the control, get those properties and print whatever I want before the GridView using either another control or just a Literal.

So, my question is "how do I do this?" and if it's not possible, "what should be done instead?" I tried to do this in the control but it didn't work:


<asp:Literal runat="server" Text='<%# Test() %>' />

protected string Test()
  return ((Recherche)objRecherche).MyProperty;


All times are GMT -4. The time now is 10:42 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.