【问题标题】:How to Display/Hide Binded Field in Repeater Control eg. (if the field is null then hide)如何在中继器控件中显示/隐藏绑定字段,例如。 (如果该字段为空,则隐藏)
【发布时间】:2012-02-12 07:11:42
【问题描述】:

我有一个带有一些绑定列的中继器控件,我想显示/隐藏 有条件的特定列...

例如:如果转发器控件中有三列并且如果它为空则隐藏,如果不为空则显示该字段...

在此先感谢...!

【问题讨论】:

    标签: asp.net conditional repeater show-hide


    【解决方案1】:

    在本例中,我使用的是字符串类型的属性,如果您的属性来自不同的类型,请将其类型转换为该类型

    <asp:Repeater ID="rptrRepeater" runat="server">
         <HeaderTemplate>
              <table>
         </HeaderTemplate>
         <ItemTemplate>
              <tr>
                   <td id="column" runat="server" visible='<%#(string)Eval("PropertyName") != null ? true : false%>'>
                        <!-- Some control(s) to show data from -->
                   </td>
              </tr>
         </ItemTemplate>
         <FooterTemplate>
              </table>
         </FooterTemplate>
    </asp:Repeater>
    

    【讨论】:

      猜你喜欢
      • 2013-10-02
      • 2019-01-04
      • 2021-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-06
      • 2013-03-04
      • 2014-09-05
      相关资源
      最近更新 更多