Q
Quentin Huo
Hi:
I want to create a user control to render the top 10 list, which may be top
10 authors or top 10 books, or .... And it will be cached by "VaryByParam".
The UC looks same what the data is, like:
1. item1
2. item2
.......
10 item10
My question is in the code-behind: the data for different ranks come from
different tables, so I have to use "if" statement in the code-behind, like:
if(isAuthorList)
findAuthorRank...
else if(isBookList)
findBookRank...
.......
The problem is: if someday, I want to use new data to it, for example: top
10 Company, I have to modify the code-behind, is there any good solution for
it so that I don't need to modify the code-behind? Is there any design
pattern for it?
If not, any other idea?
Thanks
Q.
I want to create a user control to render the top 10 list, which may be top
10 authors or top 10 books, or .... And it will be cached by "VaryByParam".
The UC looks same what the data is, like:
1. item1
2. item2
.......
10 item10
My question is in the code-behind: the data for different ranks come from
different tables, so I have to use "if" statement in the code-behind, like:
if(isAuthorList)
findAuthorRank...
else if(isBookList)
findBookRank...
.......
The problem is: if someday, I want to use new data to it, for example: top
10 Company, I have to modify the code-behind, is there any good solution for
it so that I don't need to modify the code-behind? Is there any design
pattern for it?
If not, any other idea?
Thanks
Q.