一个基于两个下拉列表的gridview [英] one gridview based on two dropdownlists

查看:89
本文介绍了一个基于两个下拉列表的gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我对asp.net非常陌生.

我面临一个问题;通过在gridview上方放置两个下拉列表,记录必须根据从下拉列表中选择的文本进行更改.

Hi friends,

I''m very new to asp.net.

I''m facing a problem; by placing two dropdownlists above the gridview, the records have to change according to the text selected from the dropdownlists.

推荐答案

只需编写两个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>


这篇关于一个基于两个下拉列表的gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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