评论会员:P.Salini 时间:2012/02/06
autopostback="true"
属性在ASPX集中到下拉
在后面
代码
在下拉列表中选定的指数变化的事件编写的查询得到的结果
{C}
然后连接到数据库,并获得记录,然后绑定到GridView的数据集:巴拉Selvanayagam:1。载入"DropDownList1"
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!Page.IsPostBack){
using (SqlConnection oConn = new SqlConnection()){
oConn.ConnectionString = "data source=localhost;initial catalog=test_db;user=sa;password=123";
SqlDataAdapter oda = new SqlDataAdapter("select distinct year from Acadamics", oConn);
DataSet ds = new DataSet();
oda.Fill(ds);
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataValueField = "year";
DropDownList1.DataTextField = "year";
DropDownList1.DataBind();
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
2。
"DropDownList1"
属性更改{的C4}
3。填充DropDownList的选定指数电网改变事件。
{C5的}
试图通过组合框的值的网格人口的方法,使用参数,以避免任何SQL注入:farogh海德尔| |收集的数据表中的所有数据,然后通过过滤器使用的RowFilter从DropDownList的选定项目
评论会员:游客 时间:2012/02/06
imgsrc=http://www.orcode.com/img/ico/smiley_smile.gif可以帮助你。imgsrc=],也可能对你有用
bandroid
评论会员:游客 时间:2012/02/06
谢谢..问题已经解决了......{S0}
codejet
评论会员:游客 时间:2012/02/06
U可以使用一个普通的ListView。选择到DataTable中,遍历每行每列垫它的阅读价值权适当的数据。串连成一个字符串变量值从一排的变量添加到列表视图
moneymakermaster:使用SqlDataSource控件从设计模式中的智能标记和配置。提到在条件和它绑定到下拉列表中