简体   繁体   English

从单一来源填充多个下拉列表并动态更改数据

[英]Populating multiple dropdowns from single source and changing data dynamically

I have a table named employee. 我有一个名为员工的表。 I am fetching data from this table into 5 drop-downs with fields EmpNo, Unit, Location, Onsite/Offshore etc., When i am selecting a value in any of the drop-downs the values in all the drop-downs have to change. 我正在将此表中的数据提取到5个下拉列表中,其中包含字段EmpNo,Unit,Location,Insite / Offshore等。当我在任何下拉列表中选择一个值时,所有下拉列表中的值都必须更改。 Can anyone pls help me how can i acheive this?? 谁能帮我实现这个目标?

Server side solution 服务器端解决方案

There is a SelectedIndexChanged event for the dropdown control. 下拉控件有一个SelectedIndexChanged事件。 In that event, you need to reset all other dropdowns or reload some other data. 在这种情况下,您需要重置所有其他下拉菜单或重新加载其他数据。

Client side solution (with jQuery) 客户端解决方案(使用jQuery)

Listen to the change event of the first dropdown and clear the other dropdown content in that event. 侦听第一个下拉菜单的change事件,并清除该事件中的其他下拉菜单内容。

$(function(){
  $("#IDofFirstDropDown").change(function(e){
    $("#IDofSecond").html("");
  });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM