2011-06-20 28 views
17
<asp:DropDownList runat="server" ID="myListDropDown" CssClass="text" OnSelectedIndexChanged="myListDropDown_Change" /> 

No es el aspx anteriorC# cambio DropDownList caso

protected void myListDropDown_Change(object sender, EventArgs e) 
     { 
      //stuff that never gets hit 
     } 

pongo un punto de quiebre en el método myListDropDown pero nunca recibe un golpe. ¿Alguna sugerencia?

+0

Debería ser 'myListDropDown_SelectedIndexChanged()'. Consulte aquí http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist_events.aspx – Rahul

+0

@Rahul, el nombre del controlador de eventos no importa. –

+0

@Rahul myListDropDown_SelectedIndexChanged() puede tener más sentido pero no importa. Gracias por su participación. –

Respuesta

24

Conjunto AutoPostBack propiedad de su DropDownList control a true.

<asp:DropDownList AutoPostBack="true" runat="server" ID="myListDropDown" 
       CssClass="text" OnSelectedIndexChanged="myListDropDown_Change" /> 
+0

Gracias: D Much –

5

La propiedad Autopostback de DropDownList debe establecerse en 'true'.