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

Forums / Developing with Sitefinity / Styling News Module

Styling News Module

4 posts, 0 answered
  1. Femy
    Femy avatar
    37 posts
    Registered:
    02 Jan 2008
    06 Sep 2008
    Link to this post
    Hi

    In terms of styling the News module(NewsView), two things I cant seem to get right
    1) I need the date as 04.25.08. From the dropdown menu, the closest I can get to is 4.25.2008. So how can I get the date displayed as 04 instead of 4 and year as 08 instead of 2008
    2) In case the user enters a value for Source, I want the Source displayed next to the date as follows
    04.25.08 | Source
    and if the user does NOT enter a value for source then it just displays
    04.25.08
    I tried adding a label "|" in the Source field but this results in an extra "|" when the Source is empty as follows "4.25.2008 | "

    In terms of functionality, I am using version 3.2 SP2 and there is a single NewView control which I added to the page and in the property "How to display full item information page" I selected the second option and added the link to file"~/Company/PressReleases/PressReleaseDetails.aspx", but on the live site when I click a link to the news item, it goes to a link as "Company/PressReleases/PressReleaseDetails/08-04-25/Geolocation_Technology_for_Online_Content.aspx?ReturnURL=%2fDefault.aspx"
    and the page NOT found is displayed. I dont see a lot of documentation for this new version of the control.

    Any ideas what I am doing wrong here. Pls advice.

    TIA
    FR
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    06 Sep 2008
    Link to this post
    I'm not entirely sure I understand what you're trying to accomplish in #2 but for #1, you can use a format string to set the date to display as you'd like it

    just go to the page with the newsview and edit it, and click on the "Advanced" tab and under "Appearance" there is a field for "DatesFormat". you can use any datetime format string (more details available here: http://msdn.microsoft.com/en-us/library/az4se3k1.aspx) to format the date as you'd like it. in your case you would enter

    MM.dd.yy

    in the field and it should render the date as you're requesting.

    hope this was helpful! if you can elaborate more on #2 and what you're trying to accomplish vs what is happening I'll do my best to help
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    08 Sep 2008
    Link to this post
    Hello Femy,

    You can also try changing the date format in ListPageMaster.ascx and ContentViewItemList.ascx under

    ~\Sitefinity\ControlTemplates\News\Modes\ListPageMaster.ascx  and  ~\Sitefinity\ControlTemplates\News\ directory.

    In ListPageMaster.ascx replace <
    asp:Literal ID="Publication_Date" runat="server" Text="{0}" />  with

    <sf:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString=""></sf:DateTimeLiteral>  

    In ContentViewItemList.ascx  just change the DataFormatString with the above one, because the TagPrefix is different.

    For more information about data formats, please refer MSDN as SelArom suggested.

    As for the pipe divider please do the following:

    1. Drag and Drop the NewsView control to the content place holder.
    2. Click Edit control
    3. Go to Settings For every item in the news list, display:
    4. Select from Source "set label and format"
    5. In the String format text box enter  "| {0}" - without quotations marks

    Find the attached screenshot for your convenience.

    Hope this helps.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. Femy
    Femy avatar
    37 posts
    Registered:
    02 Jan 2008
    09 Sep 2008
    Link to this post
    Thanks Ivan. This is exactly what I wanted. Works great now. Also got the list and details modules working as needed.
    Thx
    FR
Register for webinar
4 posts, 0 answered