:master: ho fatto delle prove e non vedo problemi
se EnableViewState del dropdown è attivo non ci sono problemi.
codice:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Me.IsPostBack Then
libreria.FillListControl(Me.DropDownList1, gl.StringaConnessioneTest, "select top 10 codice_istat_comune, nome_comune from comuni", "nome_comune", "codice_istat_comune", New ListItem("", ""))
Else
Me.TextBox1.Text = Me.DropDownList1.SelectedItem.Text
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Me.TextBox1.Text = Me.DropDownList1.SelectedItem.Text
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Pagina senza titolo</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>
</html>
dove il caricamento del TextBox avviene o nell'evento Button1_Click, ma anche nell'evento load