Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.NET
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
     <ContentTemplate>
       <asp:DropDownList ID="departmentID" runat="server" onselectedindexchanged="txtCompanyID_SelectedIndexChanged"> </asp:DropDownList>
       <asp:DropDownList ID="employeeID" runat="server"> </asp:DropDownList>
     </ContentTemplate> 
</asp:UpdatePanel>


Please help me with this issue.
Thanks in advance. Have a nice day!
Posted

Add the below code inside your update panel
C#
<Triggers>
<asp:AsyncPostBackTrigger ControlID="departmentID" EventName="SelectedIndexChanged" />
</Triggers>
 
Share this answer
 
Comments
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)
SQL
<asp:DropDownList ID="departmentID" AutoPostback="true" runat="server" onselectedindexchanged="txtCompanyID_SelectedIndexChanged"> </asp:DropDownList>
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900