数据驱动的年份列表未与数据列表正确显示

问题描述 投票:0回答:1

我遇到问题,无法按照我的潜在客户要求来排列我的年度列表复选框。

当前显示如下:>

1980 1984 1987 1990
1981 1985 1988 1991
1982 1986 1989 1992
1983

我需要使其看起来像这样

1980 1984 1988 1992
1981 1985 1989
1982 1986 1990
1983 1987 1991

他希望除最后一列外,其余各列均要填写。年数发生了变化,因此我无法对其进行硬编码。

我当前正在使用数据列表,而我的数据来自oracle过程,只是选择了年份。

    <asp:DataList 
          ID="dlYears"              
          width="100%"
          runat="server" 
          GridLines=Horizontal 
          RepeatColumns="4" 
          RepeatDirection="Horizontal"               
          Font-Bold="False" 
          Font-Italic="False"               
          Font-Overline="False" 
          Font-Strikeout="False" 
          Font-Underline="False" 
          ShowFooter="False" 
          CellPadding="0">             
            <ItemStyle cssclass="text_11" />
            <HeaderTemplate>      
                  </td>
                </tr>
                <tr class="heading">    
                  <td colspan="4">
                    <table style="width:100%;">
                      <tr>
                        <td>&nbsp;YEARS
                        </td>
                        <td style="text-align:right;">
                          <table style="width:100%;">
                            <tr>
                              <td>
                                <asp:ImageButton ID="ibYearsAll" ToolTip="Check all years" runat="server" ImageUrl="../images/circle_blue.png" onclick="ibYearsAll_Click"  />                                    
                              &nbsp;
                                <asp:ImageButton ID="ibYearsNone" ToolTip="Uncheck all years" runat="server" ImageUrl="../images/circlered.png" onclick="ibYearsNone_Click" />                                    
                                &nbsp;&nbsp;
                              </td>                                  
                            </tr>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>   
              </HeaderTemplate>          
              <ItemTemplate>                    
                <asp:CheckBox ID="chkYear" runat="server" Checked=false Enabled="false" />
                <asp:Label class="text_11" ID="lblYear" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"year") %>'></asp:Label>            
                </td>            
              </ItemTemplate>
            </asp:DataList>  

我已经搜索并找到了类似的问题,但没有一个有效的答案。中继器可以满足我对复选框的要求吗?更改现有代码将需要更多工作,但是如果可以,那么我会做。

谢谢

我遇到问题,无法按照我的潜在客户要求来排列我的年度列表复选框。目前,它的显示方式如下:1980 1984 1987 1990 1981 1985 1988 1991 1982 1986 1989 1992 1983我需要制作它...

asp.net datalist
1个回答
0
投票

我能够使用这里的建议:How to make a CheckBoxList with different number of items in each column?生成我的复选框列表,其中年份沿正确的方向流动,并且前3列已满,而第4列则剩余年份。

© www.soinside.com 2019 - 2024. All rights reserved.