数据绑定问题 - 从下拉列表到gridview内的下拉列表 [英] data bind issue--from dropdownlist to dropdown inside the gridview

查看:95
本文介绍了数据绑定问题 - 从下拉列表到gridview内的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面中有dropdownlist1,gridview里面有dropdownlist.2



我将数据从数据库绑定到dropdownlist1。基于dropdownlist1中的选定值,数据库内不同行的相关数据列表必须绑定到gridview内的dropdownlist2。



任何人都可以帮助我..... .....

i have a dropdownlist1 in my page and dropdownlist2 inside gridview.

i binded data from database to dropdownlist1. Based On selected value from dropdownlist1 the related datalist from different row inside the database must be binded to dropdownlist2 inside the gridview.

can any one help me ..........

推荐答案

HI,



使用 selectedIndexChanged 为您的目的的方法。下面的示例代码供参考。





Use the selectedIndexChanged method for your purpose. A sample code below for reference.

protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
   {
       IList<State> states = GetStateList(GetCountryList()[((DropDownList)sender).SelectedIndex]);
       ddlStates.DataSource = states;
       ddlStates.DataBind();
   }









链接帮助您了解您的问题如下。



Asp.Net - 如何将DropDownList绑定到GridView中的数据库表?

ASP.NET中Gridview内的下拉列表



谢谢





Links that will help you understanding your problem are as follows.

Asp.Net - How to Bind a DropDownList to a Database table in GridView?
Dropdownlist inside the Gridview in ASP.NET

Thanks


这篇关于数据绑定问题 - 从下拉列表到gridview内的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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