DropDownList1 通过数据库绑定 如果我选择了“中国” 那么页面刷新一次, DropDownList2 (通过数据库绑定)相应显示广东省(第一个)、浙江省、、、、、然后下面就是我想要的效果:gridview1(数据库绑定,通过数据库控件根据DropDownList2中的值)显示相应的数据如:广州、肇庆、、、、、、、我的问题:重新选择DropDownList1的项,页面刷新了,DropDownList2的项也改了,但是gridview没有变 ,怎么解决?这就是DropDownList的联动问题么?
解决方案 »
- 使用JavaScript获取另一个页面传的值
- 关于REQUEST的querystring出现乱码问题
- 请问submit和button的区别
- datalist中怎么给生成的td属性加onmouseover事件
- XSL乱码的问题~~
- 将记录添加到数据表之后GridView只读到其中一个字段的值
- vs2005框架问题,编写好上下型框架后,为什么点击上部分网页中的按钮总是在新窗口中打开,而不是在下部分显示网页?
- 添加using excle 后我定义的返回值为datatable的函数报datatable是不明确的引用是什么问题?怎么解决?
- 能不能在.cs文件里读取repeater绑定的数据?
- easyUI datagrid的问题
- 使用webBrowser时遇到的线程问题
- 谁有选项卡(C#)的实例
没有的话gridview不会变的吧
在DropDownList2的项更新后,应该按新的DropDownList2的项,或用第一个去查gridview的值显示出来吧。
if(!ispostback)
{
//绑定DropDownList1
//通过DropDownList1的选择项绑定DropDownList2
}
//通过DropDownList2的选择项绑定gridview1
============================================
DropDownList1的autopostback=true
DropDownList1的selectedindexchanged事件中:
{
//绑定DropDownList2
}
============================================
的autopostback=true
DropDownList2的selectedindexchanged事件中:
{
//这步可以不用(通过DropDownList2的选择项绑定gridview1)
}
重新选择DropDownList1的项,页面刷新了,DropDownList2的项也改了,但是gridview没有变
===
这个要看你自己的想法了,你是想按哪个来绑定gridview,刷新时更改查询条件
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddl" runat="server" Width="15%" AutoPostBack="True" OnSelectedIndexChanged="ddl_SelectedIndexChanged">
</asp:DropDownList>
<asp:DropDownList ID="ddlChild" runat="server" Width="20%">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</div>
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
if(this.ddl.SelectedValue!=null)
{ }
}