I am trying to render a search results page in tabbed layout (with categories as tabs). How can I make sure the tab order to be Products, Articles and Videos? Right now it always prints alphabetical (coz of orderby method I suppose). I am quite new to creating custom sorts/comparison. Thank you!
protected void ResultsRedendering(List<Item> searchResult)
{
_searchResults = searchResult.GroupBy(i => i.TemplateName).OrderBy(p=>p.Key).ToList();
_searchResults.RemoveAll(i => i.Key != "Product" && i.Key != "Article" && i.Key != "Video");
rptResultTab.DataSource = _searchResults;
rptResultTab.DataBind();
}
This is how my item template renders each tab…
<ItemTemplate>
<li><a href="#<%#((IGrouping<string , Item>)Container.DataItem).Key %>">
<%#((IGrouping<string, Item>)Container.DataItem).Key)%></a></li>
</ItemTemplate>
Also, _searchResult is of type List<IGrouping<string,Item>>
while maybe not 100% optimal this should work.