下拉数据加载&事件解雇 [英] dropdown data loading & event firing

查看:135
本文介绍了下拉数据加载&事件解雇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我面临的问题如下所述:

我在asp.net页面有两个下拉控件。

第二次加载基于第一次下拉,当第一个只有一个数据时它没有被触发而第二个没有加载。

我试过第一次修复项目--select--。现在它的工作,但需要appenddatabounditem true。

这个原因问题,就像第一次下拉2数据,如果我选择第一个数据,第二个下拉数据加载,然后第二个数据第一个下拉选择然后它不会清除以前的data.i已经尝试过items.clear这一个但结果是一样的。



请你能帮助任何人找出来一个方法。



N:B:如果需要更多澄清问题请评论。



谢谢提前

Mahmud

Dear,

I am facing problem as follows describes bellow,
I have two drop-down control in asp.net page.
2nd one load based on first drop-down,when first one have only one data it is not fired & 2nd one not loaded.
I have tried first one fixed a item "--select--". now it''s work but need appenddatabounditem true.
This cause problem,like when first drop-down 2 data,if i select first data,data loaded in 2nd drop-down,then 2nd data in first drop-down select then it will not clear previous data.i have tried items.clear this one but result is same.

Please can u help anyone to find out a way.

N:B: if needed more clarification in problem please comments.

Thanks in Advance
Mahmud

推荐答案

尝试清除项目并重新重新绑定。

SelectedIndexChanged中第一个 DropDownList 事件清除 DropDownList2 的项目并重新绑定。试试这个:

Try clearing the items and rebind it again.
In the SelectedIndexChanged event of first DropDownList clear the items of DropDownList2 and rebind that. Try this:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    if(DropDownList2.Item.Count > 0)
        DropDownList2.Items.Clear(); 
    //Now bind the data again to DropDownList2
}





希望它有所帮助!

--Amit



Hope it helps!
--Amit


试试

http://csharpdotnetfreak.blogspot.in/2009/03/ populate-dropdown-based-selection-other.html [ ^ ]

https:// www .obout.com / Interface / aspnet_integration_cascading.aspx [ ^ ]

http://www.aspdotnet-suresh.com/2011/01/introduct ion-here-i-will-explain-how-to.html [ ^ ]
Try
http://csharpdotnetfreak.blogspot.in/2009/03/populate-dropdown-based-selection-other.html[^]
https://www.obout.com/Interface/aspnet_integration_cascading.aspx[^]
http://www.aspdotnet-suresh.com/2011/01/introduction-here-i-will-explain-how-to.html[^]


这篇关于下拉数据加载&事件解雇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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