跨多行的单行列表视图



是否有可能在visualstudio中将listview控件设置为单行,类似于换行?因此,换行发生在文本超过一定宽度时,而不是在超过一定数量的结果时(例如将结果显示为列)

ie:

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,它显示为单行,有交替的值:

                <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>

我找到了我要找的东西:

如何将UL元素显示为逗号分隔的平面列表

首先将listview设置为项目符号列表,然后将下面的内容添加到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;
 }

最新更新