Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a dropdownlist
ASP.NET
<asp:DropDownList runat="server" ID="DDLState" CssClass="txtp"
        onselectedindexchanged="DDLState_SelectedIndexChanged" 
        AutoPostBack="True" AppendDataBoundItems="True"
       >
      
        <asp:ListItem>Select State</asp:ListItem>
      
    </asp:DropDownList>

I am filling it on pageload.
I have a button also
ASP.NET
<asp:Button runat="server" ID="btnsubmit" Text="Submit" 
        BackColor="Silver"  onclick="btnsubmit_Click"  />

C#
protected void btnsubmit_Click(object sender, EventArgs e)
        {
 DDLState.SelectedIndex=2;
}


DDLState_SelectedIndexChangeddoes not fire.
Posted
Comments
Karthik_Mahalingam 10-Dec-13 1:26am    
you want to fire on button click or its not firing on selection change in ddl ???
Member 7909353 10-Dec-13 1:33am    
According to index, text has been changed but DDLState_SelectedIndexChangeddoes not fire

if I change text, index is also changed but DDLState_SelectedIndexChangeddoes not fire
Member 7909353 10-Dec-13 1:31am    
According to index text has been changed but DDLState_SelectedIndexChangeddoes not fire
Member 7909353 10-Dec-13 1:33am    
if I change text, index is also changed but DDLState_SelectedIndexChangeddoes not fire
Harshil_Raval 10-Dec-13 1:54am    
Check in your page load method. Have you put your dropdown fill method in !ispostback().

1 solution

Quote:
Are you sure?
Yes, Harshil_Raval is correct.

Refer- ListControl.SelectedIndexChanged Event[^].
Quote:
The SelectedIndexChanged event is raised when the selection from the list control changes between posts to the server.
 
Share this answer
 
v2

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