是否有可能隐藏在ASP列:中继? [英] Is it possible to hide a column in an asp:repeater?

查看:121
本文介绍了是否有可能隐藏在ASP列:中继?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要隐藏在 ASP列:转发。 preferably,隐藏它们不只是在HTML服务器端通过CSS。中继器有一个 ID ,但我很难找到它拥有在调试器中的表。考虑到中继器是如何工作的,我不知道它甚至有可能。我给HTML ID 键,将其设置为 =服务器,但它有错误炸毁了


  

意外的文件结尾寻找
  标签。


我该怎么办呢?我是否需要切换到一个gridview?我大概可以这样做了很多更容易的GridView。

 < ASP:直放站ID =repeaterId=服务器>
                    <&ItemTemplate中GT;
                        &所述; TR>
                            < TD><%#DataBinder.Eval的(的Container.DataItem,COL1)%>< / TD>
                            < TD NOWRAP =NOWRAPalign =left><%#DataBinder.Eval的(的Container.DataItem,COL2)%>< / FONT>< / TD>
                        < / TR>
                    < / ItemTemplate中>
                    < AlternatingItemTemplate> &所述; TR>
                            < TD><%#DataBinder.Eval的(的Container.DataItem,COL1)%>< / TD>
                            < TD NOWRAP =NOWRAPalign =left><%#DataBinder.Eval的(的Container.DataItem,COL2)%>< / TD>
                    < / AlternatingItemTemplate>
                    <&HeaderTemplate中GT;
                        <表ID =rPhysicalTable级=cssTable>
                            &所述; TR类=ACLASS>
                                <第i COL1< /第i
                                <第i COL2< /第i
                            < / TR>
                    < / HeaderTemplate中>
                    < FooterTemplate>
                        < /表>
                    < / FooterTemplate>
                < / ASP:直放站>


解决方案

继蒂姆Schmelter的意见,我切换到一个gridview。这样我可以使用

  gridviewObj.Columns [指数]。可见=虚假的;

,从而避免隐藏多个< TD>以转发

I need to hide a column in an asp:repeater. Preferably, hide them server side not just in HTML via CSS. The repeater has an ID, but I am having difficulty finding the table that it owns within the debugger. Considering how a repeater works I'm not sure its even possible. I gave the HTML table an ID and set it to runat="server", but it blew up with error

Unexpected end of file looking for tag.

How can I do it? Do I need to switch to a gridview? I could probably do this a lot easier with a gridview.

<asp:repeater id="repeaterId" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td><%# DataBinder.Eval(Container.DataItem, "col1")%></td>
                            <td nowrap="nowrap" align="left"><%# DataBinder.Eval(Container.DataItem, "col2")%></font></td>                          
                        </tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>                                                   <tr>
                            <td><%# DataBinder.Eval(Container.DataItem, "col1")%></td>
                            <td nowrap="nowrap" align="left"><%# DataBinder.Eval(Container.DataItem, "col2")%></td> 
                    </AlternatingItemTemplate>
                    <HeaderTemplate>
                        <table id="rPhysicalTable" class="cssTable">
                            <tr class="aClass">
                                <th>col1</th>
                                <th>col2</th>   
                            </tr>
                    </HeaderTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:repeater>

解决方案

Following Tim Schmelter's advice I switched to a gridview. This way I can use

gridviewObj.Columns[index].Visible = false;

And thus avoid hiding multiple <td> in a repeater.

这篇关于是否有可能隐藏在ASP列:中继?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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