如何使用下拉按钮过滤gridview? [英] how to filter the gridview using dropdown button?

查看:72
本文介绍了如何使用下拉按钮过滤gridview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

即时通讯在如何使用下拉菜单过滤我的gridview时遇到问题.

希望您能帮我解决这个问题.

非常感谢.



-chaosgray-

hello guys.

im have a problem in how to filter my gridview using a dropdown.

i hope you can help me to this matter.

thanks a lot.



-chaosgray-

推荐答案

我在互联网上进行了搜索,并提出了大量的链接.这是一些-

http://csharpdotnetfreak.blogspot.com/2011/04/gridview-filterexpression-dropdownlist.html [^ ]
http://www.eggheadcafe.com/tutorials/aspnet/c67c4daa-83c2-4baa-aea4-2c8855527acb/aspnet-gridview-filterin.aspx [ http://blog.evonet.com.au/post/使用-Filtering.aspx创建一个看起来时尚的Gridview [ http://www.aspdotnetcodes.com/Asp.Net_GridView_Filter.aspx [
I did a search on the internet and came up with tons of links. Here are some -

http://csharpdotnetfreak.blogspot.com/2011/04/gridview-filterexpression-dropdownlist.html[^]
http://www.eggheadcafe.com/tutorials/aspnet/c67c4daa-83c2-4baa-aea4-2c8855527acb/aspnet-gridview-filterin.aspx[^]
http://blog.evonet.com.au/post/Creating-a-Stylish-looking-Gridview-with-Filtering.aspx[^]
http://www.aspdotnetcodes.com/Asp.Net_GridView_Filter.aspx[^]

Choose the one which suits you best!


可以通过处理dropdownlist选择更改事件来完成.首先,将dropdownlist的autopostback属性从false更改为true.然后
< asp:dropdownlist id ="ddl1" runat ="server" autopostback ="true" onselectionindexchaged ="ddl1_onselectonindexchnaged">




后面的代码中
受保护的void ddl1_onselectionindexchanged(onject发件人,eventargs e)
{
sqldatadapter da =新sqldataadapter(从t_name选择*,其中co_name =" + ddl1.selectedvalue,cn);
....


}
ya you can do by handling dropdownlist selection changed event.First you change autopostback property of dropdownlist false to true.and
<asp:dropdownlist id="ddl1" runat="server" autopostback="true" onselectionindexchaged="ddl1_onselectonindexchnaged" >



in code behind

protected void ddl1_onselectionindexchanged(onject sender,eventargs e)
{
sqldatadapter da=new sqldataadapter("select * from t_name where co_name="+ddl1.selectedvalue,cn);
....


}


打开自动自动回传并绑定dropdownlist的gridview OnSelectedIndexChanged事件
Put auto autopostback on and bind gridview OnSelectedIndexChanged event of dropdownlist


这篇关于如何使用下拉按钮过滤gridview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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