Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • John ben 78 posts 293 karma points
    Apr 13, 2017 @ 09:45
    John ben

    adding content in Search page in Umbraco

    Hi, I want to use a search which search in my entire website i used this:

    @{ var searchQuery = Request.QueryString["query"];

        if (!string.IsNullOrEmpty(searchQuery))    
            <div class="searchresults">
                <p>Your search results for <strong>@searchQuery</strong></p>
                    @foreach (var result in Umbraco.Search(searchQuery))
                            <a href="@result.Url">@result.Name</a>

    it worked perfectly the probleme i want to see the description of each result which is represented in a richtextbox, i m not too familiar with examine

  • Sven Geusens 161 posts 867 karma points c-trib
    Apr 13, 2017 @ 10:06
    Sven Geusens

    Umbraco.Search() returns a dynamic. So to get a property from it you simply do @result.PropertyName

    If you are more comfortable with IPublishedContent then use Umbraco.TypedSearch() in the same way, so you can do @result.GetPropertyValue("propertyName")

  • John ben 78 posts 293 karma points
    Apr 13, 2017 @ 10:11
    John ben

    Worked fine. Thanks a lot!

Please Sign in or register to post replies

Write your reply to: