Architecting a generic search result web control
Posted
by Bartek Tatkowski
on Stack Overflow
See other posts from Stack Overflow
or by Bartek Tatkowski
Published on 2010-05-25T08:53:01Z
Indexed on
2010/05/25
9:01 UTC
Read the original article
Hit count: 250
In a project I'm currently working for we've stumbled upon the need for several kinds of search results presentation controls. The search result are similar, but not identical. For example, in the "office search" result we might want to present the office name and location, while in the "document search" could contain document name, author and publishing date. These fields should be sortable.
My current strategy is to employ the Factory pattern and do something like this:
ISearchResult officeResults = SearchResultFactory.CreateOfficeSearchResults(data);
ISearchResult documentResults = SearchResultFactory.CreateDocumentSearchResults(data);
The problem is: I don't know how to implement the markup code. Should I just do
Controls.Add(officeResults);
in the containing page? Or is there some ASPX trickery to create generic web controls? Or maybe I'm overthinking this and just should create five classes? ;)
© Stack Overflow or respective owner