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

Forums / Developing with Sitefinity / All news items

All news items

9 posts, 0 answered
  1. Tim
    Tim avatar
    156 posts
    Registered:
    23 Sep 2007
    22 Oct 2007
    Link to this post
    Sitefinity Team,

    For news modules, is there any way I can display and sort news item by category on All news items page?

    Thanks
    Tim
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    22 Oct 2007
    Link to this post
    Hello Tim,

    For now, it is possible to display only news belonging to one category. To achieve this, set the category name in the Advanced section -> Data -> SelectedCategories field.

    As for sorting news items by Category, follow the steps below:
    1. Open NewsList control for edit
    2. Find SortBy field located in the Advanced section -> Appearance
    3. Set Category as a value of SortBy field
       
    Hope this helps.

    Greetings,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Tim
    Tim avatar
    156 posts
    Registered:
    23 Sep 2007
    22 Oct 2007
    Link to this post

    Hi Pepi,

    Thank you for your reply. I guess I didn't make myself clear. Actually I am talking about all news items page in CMS system. Because right now CMS system only shows Title, Author, Source, PublicationDate, Expiration Date, Status on the all news items page in CMS system. My question is how I can add Category column into all news items page in CMS so that I know which news belongs to which Category.

    Thanks
    Tim

  4. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    23 Oct 2007
    Link to this post
    Hi Tim,

    In order to add a field " Category " in All News Items page, you need to do the following:
    1. Add the following code to the file ControlPanelList.ascx.resx which you will find at the following path: /<your-project>/Sitefinity/Admin/ControlTemplates/News/App_LocalResources/ . The code is:
      < data name = "Category" xml: space = "preserve" >
      < value > Category </ value >
      </ data >
    2. Add the following code to the file ControlPanelList.ascx whichyou will find at the following path: /<your-project>/Sitefinity/Admin/ControlTemplates/News/ . The code is:
    1. < asp:GridView ID = "GridView1" AllowPaging = "true" AllowSorting = "true" PageSize = "20" AutoGenerateColumns = "false" GridLines = "none" CssClass = "listItems" runat = "server" >
      < Columns >
      ...
      < asp:ButtonField ButtonType = "Link" CommandName = "View" DataTextField = "Title" HeaderText = "<%$Resources:Title %>" SortExpression = "Title" > < ItemStyle CssClass = "gridContentTitle" /> </ asp :ButtonField >
      < asp:BoundField DataField = "Author" SortExpression = "Author" HeaderText = "<%$Resources:Author %>" HeaderStyle-CssClass = "GridHeader_SiteFinity" />
      < asp:BoundField DataField = "Category" SortExpression = "Category" HeaderText = "<%$Resources:Category %>" HeaderStyle-CssClass = "GridHeader_SiteFinity" />
    3. The new code is highlighted. Here, it is placed after "Author", and the result can be seen in the attached screenshot. It shows how are the categories displayed. Note: fourth news item has no category assigned.

    Hope this helps.

    Sincerely yours,
    Author nickname
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Tim
    Tim avatar
    156 posts
    Registered:
    23 Sep 2007
    23 Oct 2007
    Link to this post

    Thank you very much for your help.

    I am going to assume that I can do the same thing to the Generic Content.

    Please let me know if I am right.
    Tim



  6. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    23 Oct 2007
    Link to this post
    Hello Tim,

    We are glad that we helped. Yes, you can add the same code to the Generic Content  module as well. You only need to open the correct folder for the desired module and find the exact same files as I described in the previous post. That is:
    • /<your-project>/Sitefinity/Admin/ControlTemplates/Generic_Content/App_LocalResources/
    • /<your-project>/Sitefinity/Admin/ControlTemplates/Generic_Content/
    You could actually apply that to any module that works with categories (when you want to display the Category Field).

    Sincerely yours,
    Sonya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Tim
    Tim avatar
    156 posts
    Registered:
    23 Sep 2007
    23 Oct 2007
    Link to this post
    Sitefinity Team,


    It worked for Generic Content, but it doesn't work for Forum module.

    Is there anything I can do to make it work for Forum module?
    Thanks
    Tim
  8. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    23 Oct 2007
    Link to this post

    Hi Tim,

    The Forums module is a little bit different from News and Blogs. It uses its own categories and is not based on Generic Content. You can configure Forums categories from the Forums administration, there is a separate menu on the left. When creating Forums, you can assign them to a specific category or leave them Uncategorized. In the admin part, by default forums are displayed for each category. There are headers for the categories and there is a table with the forums in each. Additionally, there is a table with all Uncategorized forums. Please refer to the attached screenshot. In this case adding a Category column wouldn't make sense since it would be the same for all forums in one particular table.

    If you still want to do it, here is how:

    1. Open the file ~/Sitefinity/Admin/ControlTemplates/Forums/ControlPanelAllForumsTemplate.ascx.
    2. There are two GridViews in this template - one with ID "inner" and one with ID "Uncategorized".
    3. Add the following markup to both 

    <asp:TemplateField HeaderText="> 
       <ItemTemplate> 
          <%# DataBinder.Eval(Container.DataItem, "Category.Name")%> 
       </ItemTemplate> 
    </asp:TemplateField> 

    However, I don't see a point in doing such a thing for Forums. I want to warn you that you'd better back up the changed files, because they would be lost when you upgrade to the next version.

    Regards,

    Slavo
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Tim
    Tim avatar
    156 posts
    Registered:
    23 Sep 2007
    23 Oct 2007
    Link to this post
    Hi Slavo,

    I think I see your point. I just leave the way it's. :)

    Thanks
    Tim
Register for webinar
9 posts, 0 answered