I have two dropdown lists. One is showing emp_id , while the other is showing emp_name. Both lists use the same sql data source which queries as : select emp_id , emp-name from emp_table
How do i make changes of one dropdownlist reflect on other?
Say, if i select emp-id, then corresponding emp_name should be selected automatically and vice versa. How can we do that? I have used SqlDataSource from toolbox and have not configured it manually through code. I am passing a stored procedure which returns emp_name and emp_id from emp_table.
This is simple asp.net project and no mvc has been used.
Use this setup:
Use the emp_id as the value for both drop downs.
Add a SelectedIndexChange
event handler for both drop downs. In the event handler, get the emp_id value and set the selected value of the other drop down to the same emp_id.
Set properties Autopostback=true
and CausesValidation=false
for both drop down.