I’ve finally deployed the DotNetNuke site I’ve been working on. After deployment is when the most obvious things pop up.

For instance, in DotNetNuke when you search for something in the site it will return a list of links to what it finds. What it won’t do is display something friendly like “No Search Results Found” if it doesn’t find anything. Dumb and not very user friendly.

I did find what I thought would be the solution at ecktwo, but it didn’t work in Firefox due to the


which doesn’t work in Firefox within a table, which is what the Search Results are generated using the ASP.NET grid view. So, I thought I’d take a stab at building something that worked for both IE and Firefox.

Make a copy of your admin\Search\SearchResults.ascx file and then open the file in notepad. Apply the following code that I’ve highlighted in red:

<%@ Control Language=”vb” AutoEventWireup=”false” Explicit=”True” Inherits=”DotNetNuke.Modules.SearchResults.SearchResults” CodeFile=”SearchResults.ascx.vb” %>

<asp:Datagrid id=”dgResults” runat=”server” AutoGenerateColumns=”False” AllowPaging=”True” BorderStyle=”None”
PagerStyle-CssClass=”NormalBold” ShowHeader=”False” CellPadding=”4″ GridLines=”None”>
<asp:Label id=lblNo runat=”server” Text='<%# DataBinder.Eval(Container, “ItemIndex”) + 1 %>’ CssClass=”SubHead”>
<asp:HyperLink id=”lnkTitle” runat=”server” Name=”result” CssClass=”SubHead” NavigateUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem,”TabId”),
DataBinder.Eval(Container.DataItem,”Guid”)) %>’ Text='<%# DataBinder.Eval(Container.DataItem, “Title”) %>’>
<asp:Label id=”lblRelevance” runat=”server” CssClass=”Normal” Text='<%# FormatRelevance(DataBinder.Eval(Container.DataItem, “Relevance”)) %>’ >
<asp:Label id=”lblSummary” runat=”server” CssClass=”Normal” Text='<%# DataBinder.Eval(Container.DataItem, “Description”) + “<br>” %>’ Visible=”<%# ShowDescription() %>”>
<asp:HyperLink id=”lnkLink” runat=”server” CssClass=”CommandButton” NavigateUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem,”TabId”),
DataBinder.Eval(Container.DataItem,”Guid”)) %>’ Text='<%# FormatURL(DataBinder.Eval(Container.DataItem,”TabId”),
DataBinder.Eval(Container.DataItem,”Guid”)) %>’>
<asp:Label id=”lblPubDate” runat=”server” CssClass=”Normal” Text='<%# FormatDate(DataBinder.Eval(Container.DataItem, “PubDate”)) %>’>
<PagerStyle CssClass=”NormalBold” Mode=”NumericPages”></PagerStyle>

<div id=”NoResults”>
<h3 class=”red” style=”text-align:center”>No Search Results Found</h3>
<script language =”Javascript”>
var search;
search = document.getElementsByName(“result”);

if (search.length == 0) {
else {

Be sure to add the Name=”result” snippet to the asp:Hyperlink in the code above. It’s easy to miss.

Save that and you should now have a spiffy new message displayed when no results are found. Use whatever CSS you want to style the message.