如何根据另一个下拉列表的操作设置下拉列表的操作? [英] How can I set the action of a dropdownlist according to the action of another dropdownlist?

查看:90
本文介绍了如何根据另一个下拉列表的操作设置下拉列表的操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的工作中,特定的webform包含两个下拉列表,其ID分别为DepartFrom和DepartTo。每个列表包含相同的文本项。文字是Dhaka,Chittagong,Sylhet,Cox''sbazar。



现在我想采取以下行动:



1.当我在DepartFrom列表中选择Dhaka时,它不会出现在DepartTo列表中,但其他人将会出现。

2.当我选择''Text ''除了'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''让我更好地在C#中获得反馈。

解决方案

你好Sopner Feriwala



我强烈推荐你看看这个:

http: //msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.aspx



了解以下活动:

SelectedIndexChanged

TextChanged



而不是基于文本项的条件,我建议你基于文本值。但是,由于值几乎保持不变,因此文本可能会经常更改。



如果您还有其他问题,请随意询问。



最好的问候。

In my work , a particular webform consist two dropdownlist whose IDs are respectively "DepartFrom" and "DepartTo". Each list consist the same text items. Texts are "Dhaka, Chittagong, Sylhet, Cox''sbazar".

Now I want to action as follows :

1. When I select "Dhaka" in "DepartFrom" list it will not appear in the "DepartTo" list, but the others will.
2. When I select ''Text'' except ''Dhaka'' in ''DepartFrom'' list, only ''Dhaka'' will appear in the "DepartTo" list.

It will be better for me to get feedback in C#.

解决方案

Hello Sopner Feriwala

I Higly recommend you to take a look at this:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.aspx

Read about the following events:
SelectedIndexChanged
TextChanged

Instead of basing conditions in Text Item, I recommend you basing on Text Value. Because values remain practically unchanged, however, the text may change frequently.

If you still have any other question, please fell free to ask.

Best Regards.


这篇关于如何根据另一个下拉列表的操作设置下拉列表的操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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