且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

一个基于两个下拉列表的gridview

更新时间:2023-11-29 19:08:10

只需编写两个DropDownList的Selection_change事件,两个DropDownList的属性-AutoPostBack = true ...
现在,只要您从DropDownList中选择一个项目,就会触发相关的Selection_Change事件...
因此,在此处编写代码以根据需要触发查询,并将数据绑定到GridView ...
just write a Selection_change event of both DropDownList, make one property of both DropDownList -- AutoPostBack = true...
now whenever you select an item from DropDownList, related Selection_Change event will be fire...
so write your code there to fire a query as per need and bind the data to the GridView...


尝试此链接

http://www.aspnettutorials.com/tutorials/controls/dropdownlist-gridview-csharp.aspx [^ ]
http://csharpdotnetfreak.blogspot.com/2009/08/radiobuttonlist-dropdown-gridview- edit.html [ ^ ]
try this link

http://www.aspnettutorials.com/tutorials/controls/dropdownlist-gridview-csharp.aspx[^]
http://csharpdotnetfreak.blogspot.com/2009/08/radiobuttonlist-dropdown-gridview-edit.html[^]


在下拉列表属性中放入autopostback = true并处理事件选择索引已更改

在那一个像这样的绑定gridview
sqldataadapter da =新sqldataadapter(& quot;从tname中选择*其中colname =& quot; + ddl1.selectedvalue,cn);</pre>
put autopostback=true in dropdownlist properties and handle the event selectionindexchanged

in that one bind gridview like

sqldataadapter da=new sqldataadapter(&quot;select * from tname where colname=&quot;+ddl1.selectedvalue,cn);</pre>