+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Search Forums

Search Forums

7 posts, 0 answered
  1. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    06 Jan 2011
    Link to this post
    Hi,
    I want to create a functionality to search Forums and Blogs. Currently I am using a below code for News Search. What change will required to search Forums?

     ContentManager contentManager = new ContentManager("News");
            List<IMetaSearchInfo> filter = new List<IMetaSearchInfo>();

            if (Keyword.Text != "")
            {
                filter.Add(new MetaSearchInfo(MetaValueTypes.ShortText, "Title", Keyword.Text.ToString()));
                System.Collections.IList listOfContentItems = contentManager.GetContent(filter.ToArray());

                if (listOfContentItems.Count == 0)
                {
                    lbl_search_result.Text += "<br />No result found!!";
                }
                else if (listOfContentItems.Count > 0)
                {
                    lbl_search_result.Text += "<br />" + listOfContentItems.Count.ToString() + " News found!!";
                    forumsRepeater.DataSource = listOfContentItems;
                    forumsRepeater.DataBind();
                  
                }
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    06 Jan 2011
    Link to this post
    Hello Asif,

    Please take a look at


    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    07 Jan 2011
    Link to this post
    Hi,
    Actual I want to find Forums with specific forum name. I couldnt find the solution from the reference links you mentioned. because, I can't find any where I can provide the Forum name and get the specific search result.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    07 Jan 2011
    Link to this post
    Hello Asif,

    You can use Linq to get designer post from list of IForm items that you can get by calling -GetForums method.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    07 Jan 2011
    Link to this post
    Hi,
    I am asking you a lot. Can you give me a one small example to use Linq for listOfForums??
  6. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    08 Jan 2011
    Link to this post
    I think I found the solution. Thanks for the help. One question. How to merge the search result with external template "ForumList.ascx". The code in this template is. I want to show the result using the below repeater / Gridview

    <asp:Repeater ID="forumsRepeater" runat="server"><br>
        <HeaderTemplate><br>
            <br>
        </HeaderTemplate><br>
        <ItemTemplate><br>
    <div class="block-heading message-option"><br>
                <%#DataBinder.Eval(Container.DataItem, "Name")%><br>
            </div><br>
                <br>
                <br>
    <br>
            <asp:GridView ID="inner" runat="server" CssClass="sf_forumsList" AutoGenerateColumns="false" GridLines="none"><br>
                <Columns><br>
                   <asp:TemplateField HeaderText="Status" Visible="false"><br>
                        <ItemTemplate><br>
                            <asp:Literal ID="forumStatus" runat="server"></asp:Literal><br>
                        </ItemTemplate><br>
                    </asp:TemplateField> <br>
                    <asp:TemplateField HeaderText="Forum:"><br>
                        <ItemTemplate><br>
                            <asp:LinkButton ID="btnOpenForum" runat="server"></asp:LinkButton><br>
                            <div><asp:Literal id="lblDescription" runat="server"></asp:Literal></div><br>
                        </ItemTemplate><br>
                        <ItemStyle CssClass="sf_forumTitle" /><br>
                    </asp:TemplateField><br>
                    <br>
                    <asp:BoundField DataField="PostsCount" HeaderText="#Posts" /><br>
                    <asp:BoundField DataField="ThreadsCount" HeaderText="#Replies" /><br>
                    <asp:TemplateField HeaderText="<%$Resources:LastPost %>" HeaderStyle-CssClass="sf_forumAuthor"><br>
                        <ItemTemplate><br>
                            <asp:LinkButton ID="goToPost" runat="server" CausesValidation="false"><sfWeb:DateTimeLiteral ID="lastPostDate" runat="server" DateFormatString="dd MMM yyyy, hh:mm"></sfWeb:DateTimeLiteral></asp:LinkButton><br>
                            <asp:Label ID="noPosts" runat="server" Text="<%$Resources:NoPosts %>"></asp:Label><br>
          <br>
                            <asp:Label ID="byText" runat="server" Text="By&nbsp;" Visible="false"></asp:Label> <br>
                            <prof:ManageProfile ID="lastPostAuthor" runat="server" ShowAnonymousLabel="true" AnonymousLabel="<%$ Resources:Anonymous %>" Visible="false"><br>
                                <ViewTemplate><br>
                                    <asp:Literal ID="FirstName" runat="Server"></asp:Literal>&nbsp;<br>
                                    <asp:Literal ID="LastName" runat="Server"></asp:Literal><br>
                                </ViewTemplate><br>
                            </prof:ManageProfile> <br>
                        </ItemTemplate><br>
                        <ItemStyle CssClass="sf_forumAuthor" /><br>
                    </asp:TemplateField><br>
                </Columns><br>
            </asp:GridView><br>
            <span class="divider"></span><br>
        </ItemTemplate><br>
        <FooterTemplate><br>
            <br>
        </FooterTemplate><br>
    </asp:Repeater>
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    10 Jan 2011
    Link to this post
    Hello Asif,

    You can add a TextBox and input that will call the SearchManger.Search static method

    <fieldset class="sf_searchBox">
        <asp:Label runat="server" AssociatedControlID="queryText" Text="Search" />
         
            <asp:TextBox ID="queryText" runat="server" CssClass="sf_searchText"></asp:TextBox>
     
       <div>
            <input type ="button"  id="searchButton" runat="server"  class="sf_searchSubmit" value="Search" alt="Search"/>
       </div>
    </fieldset>

    or declare SearchBox control in the ForumList.ascx

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
7 posts, 0 answered