【问题标题】:Data driven year list not displaying correctly with datalist数据驱动的年份列表无法与 datalist 正确显示
【发布时间】:2020-05-20 23:24:09
【问题描述】:

我遇到了一个问题,让我的年份列表复选框按照我的潜在客户要求排列。

目前是这样显示的

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>  

我已经搜索并找到了类似的问题,但没有一个有效的答案。中继器会用复选框做我正在寻找的东西吗?这将是更改现有代码的更多工作,但如果它有效,那么我会这样做。

谢谢

【问题讨论】:

  • 只是一个问题:你为什么使用oracle标签?
  • 我试图做到彻底,我想包括我正在使用的所有技术。提取我的信息的查询是一个 oracle 过程。我应该排除它吗?
  • 感谢您的回复。是的,我认为没有标签会更好。我正在观看标记为 oracle 的新问题,我无法以任何方式帮助您。此外,它不会帮助有同样困难的人找到您的问题。
  • 我更新了问题并删除了oracle。谢谢你告诉我。
  • 您应该只标记与特定问题相关的内容。具有这些技术专业知识的人会遵循这些标签,如果问题相关,他们可以提供帮助。但是标记堆栈中的所有内容是否相关只会产生噪音

标签: asp.net datalist


【解决方案1】:

我可以在这里使用建议:How to make a CheckBoxList with different number of items in each column? 来生成我的复选框列表,其中年份流向正确,前 3 列已满,第 4 列有剩余年份。

谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-30
    • 2020-05-19
    • 2021-08-12
    • 1970-01-01
    • 2019-07-24
    • 1970-01-01
    • 2018-07-18
    • 2020-11-12
    相关资源
    最近更新 更多