隐藏在嵌套的ListView表列 [英] Hide a table column in a nested ListView

查看:124
本文介绍了隐藏在嵌套的ListView表列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有其他的ListView里面一个ListView,我想,当特定参数传递在内部的ListView隐藏表列。下面给出的设置,我怎么会隐藏ID列(包括报头和数据)如果URL包含...?编号=没有?

 < ASP:ListView控件ID =ProcedureListView=服务器>
    <&LayoutTemplate模板GT;
        < ASP:占位符ID =itemPlaceHolder=服务器/>
    < / LayoutTemplate模板>
    <&ItemTemplate中GT;
        < H4>
            <%#的eval(PROCEDURE_ code)%GT;
        < / H4>
        < ASP:ListView控件ID =BenefitListView=服务器数据源='<%#的eval(惠)%GT;'>
            <&LayoutTemplate模板GT;
                <表格的cellpadding =5级=缩进>
                    < TR类=tableHeader为>
                        &所述; TD>
                            ID
                        < / TD>
                        &所述; TD>
                            效益
                        < / TD>
                    < / TR>
                    < ASP:占位符ID =itemPlaceHolder=服务器/>
                < /表>
            < / LayoutTemplate模板>
            <&ItemTemplate中GT;
                &所述; TR>
                    &所述; TD>
                        <%#的eval(benefit_id)%>
                    < / TD>
                    &所述; TD>
                        <%#的eval(benefit_name)%>
                    < / TD>
                < / TR>
            < / ItemTemplate中>
        < / ASP:的ListView>
    < / ItemTemplate中>
< / ASP:的ListView>


解决方案

如果你正在试图做到这一点从code的后面,那么你可以这样做:

在对外部的ListView你会发现内部ListView控件,然后找到你想要的标签和Visible属性更改为false的onBind事件。我回答了这个在您的其他问题。

好运!

I have a ListView inside another ListView, and I'd like to hide a table column in the inner ListView whenever a particular parameter is passed. Given the setup below, how would I hide the ID column (both the header and the data) if the URL contains "...?id=no"?

<asp:ListView ID="ProcedureListView" runat="server">
    <LayoutTemplate>
        <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
    </LayoutTemplate>
    <ItemTemplate>
        <h4>
            <%#Eval("PROCEDURE_CODE") %>
        </h4>
        <asp:ListView ID="BenefitListView" runat="server" DataSource='<%#Eval("benefits") %>'>
            <LayoutTemplate>
                <table cellpadding="5" class="indent">
                    <tr class="tableHeader">
                        <td>
                            ID
                        </td>
                        <td>
                            Benefit
                        </td>
                    </tr>
                    <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%#Eval("benefit_id")%>
                    </td>
                    <td>
                        <%#Eval("benefit_name")%>
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
    </ItemTemplate>
</asp:ListView>

解决方案

if you are trying to do this from the code behind then you could do this:

On the onBind event for the outer ListView you would find the inner listview control, and then find the label you want and change the visible property to false. i answered this on your other question.

good luck!

这篇关于隐藏在嵌套的ListView表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆