如何在 ASP.NET 动态数据中仅隐藏列表页面上的列?

发布于 2024-07-05 13:38:37 字数 285 浏览 6 评论 0原文

这有点类似于这个问题

但是,我不想隐藏所有列,而只是想隐藏 List.aspx 页面上的列。

我的具体示例是,长字段(或至少是 nvarchar(MAX))会自动从 List.aspx 页面中隐藏,但在 Edit.aspx 页面上仍然可见。

我想为其他(较短的)列复制此行为。

这可能吗?

This is somewhat similar to this question.

However, rather than wanting to hide a column all together, I am just looking to hide the column on the List.aspx page.

My specific example is that fields that are long (or at least nvarchar(MAX)) automatically hide from the List.aspx page as is but are still visible on the Edit.aspx page.

I would like to replicate this behaviour for other (shorter) columns.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

微暖i 2024-07-12 13:38:38

如果你使用 bootstrap 你可以这样设置

<asp:DynamicField DataField="Id" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden"/>

if u r using bootstrap u can set like this

<asp:DynamicField DataField="Id" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden"/>
柏林苍穹下 2024-07-12 13:38:37

您可以为要更改的特定表创建自定义页面。 此处有一个示例。

在自定义页面中,您可以在 asp:GridView 控件中设置 AutoGenerateColumns="false",然后准确定义所需的列,如下所示:

<Columns>
    ...
    <asp:DynamicField DataField="Product" HeaderText="Product" />
    <asp:DynamicField DataField="Colour" HeaderText="Colour" />
</Columns>

You can create a custom page for the particular table you want to change. There's an example here.

Within your custom page, you can then set AutoGenerateColumns="false" within the asp:GridView control, and then define exactly the columns you want, like this:

<Columns>
    ...
    <asp:DynamicField DataField="Product" HeaderText="Product" />
    <asp:DynamicField DataField="Colour" HeaderText="Colour" />
</Columns>
眼泪都笑了 2024-07-12 13:38:37

我认为这个解决方案非常有用,因为它允许您使用属性模型来指定哪些列位于何处:
http://csharpbits.notaclue.net/ 2008/10/dynamic-data-hiding-columns-in-selected.html

I think this solution is a really useful one, because it allow you to use the attribute model to specify which columns go where:
http://csharpbits.notaclue.net/2008/10/dynamic-data-hiding-columns-in-selected.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文