开发者

ListView Layout

开发者 https://www.devze.com 2023-02-13 11:47 出处:网络
I am using a databound DataList in ASP.NET C# to create a tag cloud. Is there a way to make sure that each tag is rendered properly..i.e - have documentation and process and team composition on one li

I am using a databound DataList in ASP.NET C# to create a tag cloud. Is there a way to make sure that each tag is rendered properly..i.e - have documentation and process and team composition on one line as the tag cloud grows? Here's my code - many thanks for your help!

<div style="padding-left: 25px; padding-right: 25px; text-align: center;">
<asp:listview runat="server" ID="ListView1" ItemPlaceholderID="itemPlaceHolder">
    <LayoutTemplate>
        <asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
    </LayoutTemplate>
    <ItemTemplate>
        <a href='<%# GenerateNegativeStoryDetails(Eval("Tag")) %>' style="color: #ff0000; text-align: center; margin: 15px; line-height: 30px; text-decoration:none; font-size: <%# GetTagSize(Convert.ToDouble(Eval("weight"))) %>"><%# Eval("Tag") %></a>
    </ItemTemplate>
    <EmptyDataTemplate>
        <asp:Label ID="negative_tags" runat="server" style="color: #ff0000;" Text="[NO NEGATIVE TAGS FOUND]"></asp:Label>
    </EmptyDataTemplate>
</asp:listview>
</div>

<br />

<div style="padding-left: 25px; padding-right: 25px; text-align: center;">
<asp:listview runat="server" ID="ListView2" ItemPlaceholderID="itemPlaceHolder">
    <LayoutTemplate>
        <asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
    </LayoutTemplate>
    <ItemTemplate>
        <a href='<%# GeneratePositiveStoryDetails(Eval("Tag"))开发者_StackOverflow %>' style="color: #33cc00; text-align: center; margin: 15px; line-height: 3px; text-decoration:none; font-size: <%# GetTagSize(Convert.ToDouble(Eval("weight"))) %>"><%# Eval("Tag") %></a>
    </ItemTemplate>
    <EmptyDataTemplate>
        <asp:Label ID="positive_tags" runat="server" style="color: #33cc00;" Text="[NO POSITIVE TAGS FOUND]"></asp:Label>
    </EmptyDataTemplate>
</asp:listview>
</div>

ListView Layout


Consider styling the element wrapping each individual phrase with the style:

white-space:nowrap


Replace spaces in each tag with a non-breaking space GenerateNegativeStoryDetails(Eval("Tag").Replace(" ", "&nbsp;"))

0

精彩评论

暂无评论...
验证码 换一张
取 消