Sto realizzando per esercizio un'agenda in asp.net con vb.Una volta selezionato il giorno,in un campo di testo inserisco un promemoria.Quando però vado a cambiare il giorno mi ritrovo lo stesso promemoria del giorno scelto prima.Ad esempio il giorno 1/10/2010 inserisco un promemoria nel campo text che ho chiamato txttesto.Quando vado nel giorno 2/10/2010 per esempio mi ritrovo lo stesso promemoria.Il che non dovrebbe succedere.Vi posto il codice nel caso voleste darci un'occhiata:
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">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
If Not Page.IsPostBack Then
agenda.SelectedDate = agenda.TodaysDate
lblMessage.Text = agenda.SelectedDate
End If
End Sub
Sub vis(ByVal obj As Object, ByVal e As EventArgs)
lblMessage.Text = agenda.SelectedDate
If Not (Session(agenda.SelectedDate.ToString) Is Nothing) Then
txttesto.Text = Session(agenda.SelectedDate.ToString)
End If
End Sub
Sub notechange(ByVal obj As Object, ByVal e As EventArgs)
If (txttesto.Text <> "") Then
Session(agenda.SelectedDate.ToString) = txttesto.Text
txttesto.Text = ""
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Agenda in ASP.VB</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Calendar BorderColor="Red" runat="server" ID="agenda" OnSelectionChanged="vis" ></asp:Calendar>
<asp:Label runat="server" ID="lblMessage"></asp:Label>
<asp:TextBox textmode="Multiline" runat="server" ID="txttesto" OnTextChanged="notechange" AutoPostBack="true"></asp:TextBox>
</form>
</body>
</html>
Qualcuno mi può aiutare? Grazie.