ASP.NET 动态数据记录选择

发布于 2024-07-26 16:25:25 字数 120 浏览 2 评论 0原文

我正在使用 L2S 显示来自 SQL Server 的客户记录列表,其中我只想显示活动客户(其中 Status = 'A')。 如何在动态数据中实现此逻辑? 我正在使用 List.aspx 模板。 我不想要下拉过滤选项。

I am displaying a list of customer records from SQL Server using L2S where I only want to display active customers (where Status = 'A'). How do I implement this logic in Dynamic Data? I am using the List.aspx template. I don't want the dropdown filtering option.

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

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

发布评论

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

评论(1

狂之美人 2024-08-02 16:25:25

您可以通过将参数添加到 LinqDataSource 的WhereParameters 集合来完成此操作。

如果您不希望每个表都如此,则必须为该实体创建一个自定义页面,并仅将其添加到该页面上。 (视频 http://www.asp.net/Learn/3.5- SP1/video-445.aspx)

<asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true">
    <WhereParameters>
        <asp:DynamicControlParameter ControlId="FilterRepeater" />
        <asp:Parameter Name="Status" DefaultValue="A" />
    </WhereParameters>
</asp:LinqDataSource>

You can do this by adding a Parameter to the LinqDataSource's WhereParameters collection.

If you don't want this for every table, you'll have to create a custom page for that Entity, and add it only on that page. (video http://www.asp.net/Learn/3.5-SP1/video-445.aspx)

<asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true">
    <WhereParameters>
        <asp:DynamicControlParameter ControlId="FilterRepeater" />
        <asp:Parameter Name="Status" DefaultValue="A" />
    </WhereParameters>
</asp:LinqDataSource>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文