More in this section

Forums / General Discussions / Customizing a single News item

Customizing a single News item

5 posts, 1 answered
  1. Lou
    Lou avatar
    30 posts
    Registered:
    11 Aug 2011
    18 Nov 2011
    Link to this post
    We added some custom fields in our News room, but I can't figure out how to fix the line spacing when I bring it in the "single item setting". See the screen shot attached.

    I want to remove the line breaks or make some edits somehow... Thoughts?

    Code below. Thank you, Lou



            <div class="sfnewsAuthorAndDate">
                <asp:Literal Text="<%$ Resources:Labels, By %>" runat="server" /> 
                <asp:Literal runat="server" Text='<%# Eval("Author")%>' /> | <sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("Issue")%>'/> | <sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("Volume")%>' /> | <sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("Number")%>' /> | <sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("Year")%>' />
     </div>
           
  2. Amir
    Amir avatar
    33 posts
    Registered:
    24 Dec 2010
    21 Nov 2011
    Link to this post
    Lou,

    I think the <sitefinity:TextField> control has some pre-defined HTML output... Why don't you try replacing them with literals and see if that resolves it:

    <div class="sfnewsAuthorAndDate">
                <asp:Literal Text="<%$ Resources:Labels, By %>" runat="server" />
                <asp:Literal runat="server" Text="<%# Eval("Author")%>" /> | <asp:Literal runat="server" Text="<%# Eval("Issue")%>"/> | <asp:Literal runat="server" Text="<%# Eval("Volume")%>" /> | <asp:Literal runat="server" Text="<%# Eval("Number")%>" /> | <asp:Literal runat="server" Text="<%# Eval("Year")%>" />
     </div>
    Answered
  3. Lou
    Lou avatar
    30 posts
    Registered:
    11 Aug 2011
    21 Nov 2011
    Link to this post
    Hi Amir, Great idea!

    However, I'm getting a "error parsing the template".

    Maybe I mistyped something, but even copy and paste isn't working for me. :-(

    Does this look right?

    <div class="sfnewsAuthorAndDate">
                <asp:Literal Text="<%$ Resources:Labels, By %>" runat="server" />
                <asp:Literal runat="server" Text='<%# Eval("Author")%>' /> | <asp:Literal runat="server" DisplayMode="Read" Value='<%# Eval("Issue")%>'/> | <asp:Literal runat="server" DisplayMode="Read" Value='<%# Eval("Volume")%>' /> | <asp:Literal runat="server" DisplayMode="Read" Value='<%# Eval("Number")%>' /> | <asp:Literal runat="server" DisplayMode="Read" Value='<%# Eval("Year")%>' />
     </div>
  4. Amir
    Amir avatar
    33 posts
    Registered:
    24 Dec 2010
    22 Nov 2011
    Link to this post
    Lou,

    "DisplayMode" and "Value" aren't valid properties for a literal control.... delete the DisplayMode="Read" from all literals, and change "Value" to "Text".   Follow the code snippet I gave above and you should be able to get it to work.
  5. Lou
    Lou avatar
    30 posts
    Registered:
    11 Aug 2011
    29 Nov 2011
    Link to this post
    Amir, you rock! That did the trick...once I properly followed your code. Thanks again, Lou
5 posts, 1 answered