SelectedIndexChanged event does not fire?

J

Jim

Hi All,



Can someone tell me why the SelectedIndexChanged event does not fire?



<form id="Form1" method="post" runat="server">

<asp:Table id="Table1" runat="server" Width="455px" Height="61px">

<asp:TableRow>

<asp:TableCell>

<asp:DropDownList id="DropDownList1" runat="server" Width="263px"
AutoPostBack="True">

<asp:ListItem Value="bef">bef</asp:ListItem>

<asp:ListItem Value="kut">kut</asp:ListItem>

</asp:DropDownList>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</form>






private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)

{

Response.Write("it works!"); //no way!!



}



ch Jim
 
K

Karl Seguin

Where is the evnet hooked?
Since you aren't explicitely showing it and your method is private, make
sure this.DropDownList1.SelectedIndexChange +=
this.DropDownList1_SelectedIndexChanged; is in the onInit

Karl
 
D

Damon Payne

In your code behind, is the DropDownList1_SelectedIndexChanged method
assigned to DropDownList1's IndexChanged event? It needs to be either in the
code behind or in the ASPX page
 
J

Jim

thanks Carl and Damon for the solution!

ch Jim
Damon Payne said:
In your code behind, is the DropDownList1_SelectedIndexChanged method
assigned to DropDownList1's IndexChanged event? It needs to be either in
the
code behind or in the ASPX page
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top