Customizing a single News item
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>
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
>
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>
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.
Amir, you rock! That did the trick...once I properly followed your code. Thanks again, Lou