@{
var searchQuery = Request.QueryString["query"];
if (!string.IsNullOrEmpty(searchQuery))
{
var searchResults = Umbraco.Search(searchQuery);
if (searchResults != null)
{
<div class="searchresults">
<p>Your search results for <strong>@searchQuery</strong></p>
<ul>
@foreach (var result in searchResults)
{
<li>
<a href="@result.Url">@result.Name</a>
</li>
}
</ul>
</div>
}
else
{
<div class="searchresults">
<p>Your search results for <strong>@searchQuery</strong></p>
<ul>
<li>No result found were found for your search quesry: @searchQuery<</li>
</ul>
</div>
}
}
}
if no data found in Umbraco Search i need to display error message how to do that
My code is
any solution?
You could do something like this?
still have problem
if user enter junk data then it doesn't execute else command it goes to if part
Have you put a break point on
To see whats returning? You can then filter on the results.
Worked
with null i just put searchResults.Any() and code goes to Else condition on junk data
Final Working Code
}
is working on a reply...