.net2.0中GridView中过滤数据
我有一个页面,使用 GridView 显示从存储过程中获取的一些数据 返回的
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString1 %>"
SelectCommand="p_get_all_students" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
列之一是 studyYear ,可能的值:1,2,3
我想添加一组 3 个复选框允许按 studyYear 过滤显示的结果
我该怎么做?
<罢工> 理想情况下,我希望将存储过程保留为 p_get_all_students 并且仅过滤显示的信息 - 因此只会对数据库进行一次初始调用。
编辑 存储过程返回的行数为20到200
I have a page that uses GridView to display some data taken from a stored procedure
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString1 %>"
SelectCommand="p_get_all_students" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
One of the columns returned is studyYear with the possible values: 1,2,3
I would like to add a set of 3 checkboxes to allow filtering of the displayed results by the studyYear
How could I do this?
Ideally I would like to keep the stored procedure as p_get_all_students and only filter the displayed information - so there would be only one initial call to the database.
EDIT
The number of rows returned by the stored procedure is from 20 to 200
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我个人会改变应用程序的架构方式。 如果您想保持代码相同,您可以挂钩 RowDataBound 事件。
更新 - 这是一个应该对您有帮助的示例。
I'd personally change the way the app was architected. If you want to keep the code the same though, you could hook into the RowDataBound event.
Update- here's an example which should help you.