Customizing a single News item

Posted by Community Admin on 03-Aug-2018 22:04

Customizing a single News item

All Replies

Posted by Community Admin on 18-Nov-2011 00:00

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>
       

Posted by Community Admin on 21-Nov-2011 00:00

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>

Posted by Community Admin on 21-Nov-2011 00:00

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>

Posted by Community Admin on 22-Nov-2011 00:00

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.

Posted by Community Admin on 29-Nov-2011 00:00

Amir, you rock! That did the trick...once I properly followed your code. Thanks again, Lou

This thread is closed