Search code examples
searchdotnetnukedotnetnuke-module

How to display images in search from a dnn module


In a DNN module which is ISearchable, is it possible to return an image with the search result?

The class SearchItemInfo has an int Image parameter but seemingly it is not described anywhere how to use it.

public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
{
    var SearchItemCollection = new SearchItemInfoCollection();
    using (IDataContext ctx = DataContext.Instance())
    {
        var controller = new ProductSetController();
        foreach (var product in controller.GetProductSets())
        {
            var SearchItem =
                new SearchItemInfo(product.Name, product.Summary, 0,
                        DateTime.Now, ModInfo.ModuleID, product.Code,
                        product.Description, "pid=" + product.Id.ToString(), 0);
            SearchItemCollection.Add(SearchItem);
        }
    }
    return SearchItemCollection;
}

Solution

  • The SearchItemInfo seems to have an ImageField property but it's not being used at the moment in the search results module of DotNetNuke. Please find below a link to the SearchResult.ascx user control of DotNetNuke.

    SearchResults User Control Source