Click here to Skip to main content
12,503,749 members (33,501 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0 drop-down .NET4 , +
I have included two Dropdown-lists inside an UpdatePanel. First Dropdown-list contains a list of Departments. What I want to do is, when the user selects a department, the second Dropdown-list should be populated with the list of employees work in that particular department.

I have used an Master page. The Dropdown-lists and the Script Manager are in the content page (child page). This worked Perfectly before I added the Master Page. But now, the second Dropdown-list (Employee list) updates only once.

Eg. when I change the default value of the Departments Dropdown-list, the second Dropdown-list (Employee list) updates. But if I change the Department code again, the values in the Employee list don't get updated. I checked the values in the Employee list using a break point. There the values have been updated. But the values are not displayed on the .aspx web page. (AutoPostBack property of the departmentID Dropdown-list is set to True)

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <asp:DropDownList ID="departmentID" runat="server" onselectedindexchanged="txtCompanyID_SelectedIndexChanged"> </asp:DropDownList>
       <asp:DropDownList ID="employeeID" runat="server"> </asp:DropDownList>

Please help me with this issue.
Thanks in advance. Have a nice day!
Posted 16-Mar-12 20:16pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Add the below code inside your update panel
<asp:AsyncPostBackTrigger ControlID="departmentID" EventName="SelectedIndexChanged" />
PRABHAKARAN Soundarapandian 17-Mar-12 3:26am
If again its not getting load means just add one more update panel and put the employee control in that panel and add the above code..If this answer is useful don't forget to mark as answer.
yl2rox 17-Mar-12 3:40am
Non of these doesn't make any difference. Thanks anyway. (BTW the dropdown lists are in a table)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

<asp:DropDownList ID="departmentID" AutoPostback="true" runat="server" onselectedindexchanged="txtCompanyID_SelectedIndexChanged"> </asp:DropDownList>
yl2rox 17-Mar-12 7:01am
Autopostback property is already set to true. Any way Thanks both of you! I found a solution. There were some javascripts in my master page and after I remove those scripts it works perfectly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 17 Mar 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100