VB.net跨多行的单行列表视图

时间:2013-05-23 09:03:54

标签: vb.net sql-server-2008 listview line-breaks word-wrap

是否可以将视图工作室中的listview控件集换行为单行,类似于wordwrap?因此,当文本超出某个宽度时会发生换行,而不是超出一定数量的结果(例如将结果显示为列)

即:

Matthew Chrinstina Fankie Daniel Angela James Simon Laura

作为

Matthew Chrinstina Fankie 
Daniel Angela James Simon 
Laura

Matthew Chrinstina Fankie 
Daniel  Angela     James
Simon   Laura

这是我的asp,显示为具有交替值embolden的单行:

                <div class="ExcludedStudent">
                <asp:Label ID="lvlExcludedStudents" runat="server" CssClass="boldlabel" Text="Students excluded from the Progress Measure:"></asp:Label>
                <asp:ListView ID="lvExcludedStudents" runat="server" DataSourceID="dsExcludedStudents">
                    <AlternatingItemTemplate>
                        <td runat="server" style="">                      
                            <asp:Label ID="Column1Label" runat="server" Text='<%# Eval("Column1") %>' Font-Bold="True" />
                            <br />
                        </td>
                    </AlternatingItemTemplate>
                    <EmptyDataTemplate>
                        <table style="">
                            <tr>
                                <td>None.</td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <ItemTemplate>
                        <td runat="server" style="">
                            <asp:Label ID="Column1Label" runat="server" Text='<%# Eval("Column1") %>' />
                            <br />
                        </td>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <table runat="server" border="0" style="">
                            <tr runat="server" id="itemPlaceholderContainer">
                                <td runat="server" id="itemPlaceholder">
                                </td>
                            </tr>
                        </table>
                        <div style="">
                        </div>
                    </LayoutTemplate>
                </asp:ListView>
            <asp:SqlDataSource ID="dsExcludedStudents" runat="server" ConnectionString="<%$ ConnectionStrings:MaltingsConnectionString %>" SelectCommand="spExcludedStudents" SelectCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DdlYear" Name="StuYear" PropertyName="SelectedValue" Type="String" />
                    <asp:ControlParameter ControlID="ddlDataCollection" Name="DataCollection" PropertyName="SelectedValue" Type="String" />
                    <asp:ControlParameter ControlID="DdlSubject" Name="SubjectName" PropertyName="SelectedValue" Type="String" />
                    <asp:ControlParameter ControlID="DdlTeachingGroup" Name="TeachingGroup" PropertyName="SelectedValue" Type="String" />
                    <asp:ControlParameter ControlID="ddlSubgroup" Name="Subgroup" PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>

1 个答案:

答案 0 :(得分:0)

我在这里找到了我想要的东西:

How to display UL elements as a flat comma-separated list

首先将列表视图设置为项目符号列表,然后将以下内容添加到CSS中。

/*css to comma separate the unordered list*/
  ul li{
   display:block;
   float:left;
   _display:inline;
   _float:none;
  }
  ul li::before{
   content:",";
   white-space:pre;
  }
  ul li:first-child::before{
   content:"";
  }
  ul li:last-child::before{
   content:" and";
   white-space:pre;
  }
  ul + *{
   clear:left;
 }