Can Default DNN Search Results template be edited?
Last Post 04/02/2013 7:04 AM by Joseph Craig. 3 Replies.
Author Messages Resolved
Dan Rothschild
Nuke Ace
Nuke Ace
Posts:47


--
04/01/2013 4:36 PM
    Client would like to remove some items from the search results window. For example, a typical result looks like this:

    Search results for l1 visa
    1 files - Relevance: 1213
    Immigration Glossary Immigration law has a number of highly technical terms that may not mean the s...

    Client would like to remove the first 2 lines:
    Search results for l1 visa
    1 files - Relevance: 1213

    Is this just a simple edit to the aspx or VB file? Can I just comment out the line that calls those 2 items, or is it more involved?

    Thanks in advance,
    Dan
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    04/01/2013 9:29 PM
    Dan,

    It might be easier to use CSS to set display:none to the items that you don't want to display.

    You can try rewriting the .aspx, but you'll hit problems is you remove controls that are using in the code behind file. Then there is all of that "hard to upgrade" stuff ...

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Dan Rothschild
    Nuke Ace
    Nuke Ace
    Posts:47


    --
    04/02/2013 6:53 AM
    Hi Joe,
    Thanks for the tip. I did it a bit different. I edited DesktopModules\Admin\SearchResults.aspx page and added the line visible="false" to these 2 lines:

    <asp:HyperLink id="lnkTitle" runat="server" CssClass="SubHead" visible="false" NavigateUrl='<%# FormatURL((int)DataBinder.Eval(Container.DataItem,"TabId"),(string)DataBinder.Eval(Container.DataItem,"Guid")) %>' Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>' />

    <asp:Label id="lblRelevance" runat="server" CssClass="Normal" visible="false" Text='<%# FormatRelevance((int)DataBinder.Eval(Container.DataItem, "Relevance")) %>' />

    Best,
    Dan
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    04/02/2013 7:04 AM
    Dan,

    That approach is fine, provided that you remember it before doing an upgrade. Chances are that this won't change so you should just save a copy and be prepared to copy it back after the upgrade.

    Also, I notice that the SearchResults.ascx.cs file is also there, so you could go about removing elements or adding other ones, provided that you do it carefully.

    Joe Craig, Patapsco Research Group
    Complete DNN Support


    ---