Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I have a web form in which two combo box controls and one button.
Firstcombobox data is populated in Page_Load event.

In the firstcombobox.OnsSelectedIndexChanged event i want to populate data in second combo box data based on user selection.

But the firstcombobox.OnSelectedIndexChanged event is not firing on item selection instead it is firing when button is clicked.

Here is the piece of code

C#
  <table>
     <tr>
        <td align="left" >
            <asp:Label ID="labeldate" Text="Starting Date   " runat="server" ></asp:Label>
        </td>
        <td align="left" colspan="2" >
            <asp:TextBox ID="start_date" runat="server"></asp:TextBox>
        </td>
        <ajaxToolkit:CalendarExtender ID="Cal1"  runat="server" TargetControlID="start_date" />
        </tr>

        <br />
        <br />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="start_date" Text="Starting date is required!" runat="server"></asp:RequiredFieldValidator>

       <tr> <td align="left"><asp:Label ID="label9" Text="Project Code" runat="server" ></asp:Label></td>
       <td colspan="5" ><ajaxToolkit:ComboBox ID="project_code"  runat="server" AutoPostBack="false" Width="312px"   önSelectedIndexChanged="Get_timesheets" > </ajaxToolkit:ComboBox></td>
       </tr>

       <tr> <asp:UpdatePanel ID="updatePanel1"  runat="server" UpdateMode="Conditional">
       <ContentTemplate>
       <td align="left"><asp:Label ID="label10" Text="Timesheet(s) Present" runat="server" ></asp:Label></td>
       <td colspan="5" ><ajaxToolkit:ComboBox ID="Combo_time"  runat="server"   önSelectedIndexChanged="Get_data"  Width="312px"> </ajaxToolkit:ComboBox></td>
       </ContentTemplate>
       </asp:UpdatePanel>

        <td align="center">
            <asp:Button ID="submit" runat="server" Text="OK" Width="60px" OnClick="show_timesheet" />
        </td>
       </tr>
       <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="btnprj" InitialValue="--Select Project--" ErrorMessage="Please select project code"
       ControlToValidate="project_code" Text="Project code is required!" runat="server"></asp:RequiredFieldValidator>
</table>


Dont' understand why it is doing so.

Any help is highly appreciated

Cheers
Anand
Posted
Updated 18-Jan-12 6:44am
v3

This problem got solved by creating new form with the same controls.
Looks silly, but my problem is solved.
Now everthing works fine.

Cheers
Anand
 
Share this answer
 
Comments
Tech Code Freak 19-Jan-12 8:25am    
Great!

Such things happen often and are very much annoying!!

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