Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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">
     <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 16-Mar-12 20:16pm
yl2rox324
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Add the below code inside your update panel
<Triggers>
<asp:AsyncPostBackTrigger ControlID="departmentID" EventName="SelectedIndexChanged" />
</Triggers>
  Permalink  
Comments
PRABHAKARAN Soundarapandian at 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 at 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
good
Please Sign up or sign in to vote.

Solution 2

<asp:DropDownList ID="departmentID" AutoPostback="true" runat="server" onselectedindexchanged="txtCompanyID_SelectedIndexChanged"> </asp:DropDownList>
  Permalink  
Comments
yl2rox at 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
0 CHill60 360
1 Sarvesh Kumar Gupta 238
2 OriginalGriff 218
3 Sergey Alexandrovich Kryukov 153
4 DamithSL 153


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