Ciao a tutti,
ho un GridView in un UpdatePanel. Questo GridView ha una template column che è una DropDownList. Il problema è che l'evento SelectedIndexChanged della DropDownList non viene scatenato.

Dove sbaglio?

Ecco il codice:

codice:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Prova.aspx.vb" Inherits="Prova" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<title>NUMBERS</title> 
</head> 
<body> 
<form id="form1" runat="server"> 
<div> 
<asp:ScriptManager ID="scrManager" runat="server"> 
</asp:ScriptManager> 
<asp:UpdatePanel ID="updPnl" runat="server"> 
<ContentTemplate> 
<asp:GridView ID="grdNumber" runat="server"> 
<Columns> 
<asp:TemplateField> 
<ItemTemplate> 
<asp:DropDownList ID="ddlNumber" runat="server" OnSelectedIndexChanged="ddlNumber_SelectedIndexChanged" AutoPostBack="true" > 
<asp:ListItem>One</asp:ListItem> 
<asp:ListItem>Two</asp:ListItem> 
<asp:ListItem>Three</asp:ListItem> 
<asp:ListItem>For</asp:ListItem> 
</asp:DropDownList> 
</ItemTemplate> 
</asp:TemplateField> 
</Columns> 
</asp:GridView> 
</ContentTemplate> 
</asp:UpdatePanel> 
</div> 
</form> 
</body> 
</html>
E qui c'è il codebehind:

codice:
Imports System.Data 

Partial Class Prova 
Inherits System.Web.UI.Page 


Protected Sub ddlNumber_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) 
Dim ddl As DropDownList 
ddl = sender 
MsgBox(ddl.SelectedValue) 
End Sub 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 

Dim dt As New DataTable 

dt.Rows.Add() 
dt.Rows.Add() 
dt.Rows.Add() 
dt.Rows.Add() 

Me.grdNumber.DataSource = dt 
Me.grdNumber.DataBind() 
End Sub 
End Class