M
Mark Sandfox
I created a simple calendar test app (webform1.aspx) using Visual Studios,
which works perfectly in local debug mode, but has no functionality when
posted to the website. I.e. the label fills with date information on
calendar1_selctionchanged only when run locally, but not when posted to the
website. I must be missing something very simple here. In the past I have
hand coded all my asp.net code. Page code snippet below.
Thank you in advance for your help.
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents lResults As System.Web.UI.WebControls.Label
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Calendar1.SelectionChanged
If Calendar1.SelectedDates.Count = 1 Then
lResults.Text = Calendar1.SelectedDate
ElseIf Calendar1.SelectedDates.Count = 7 Then
lResults.Text = "Week of " & Calendar1.SelectedDate & " - " &
DateAdd(DateInterval.Day, 6, Calendar1.SelectedDate)
Else
lResults.Text = Format(Calendar1.SelectedDate, "MMMM") & " has " &
Calendar1.SelectedDates.Count.ToString & " days."
End If
End Sub
End Class
which works perfectly in local debug mode, but has no functionality when
posted to the website. I.e. the label fills with date information on
calendar1_selctionchanged only when run locally, but not when posted to the
website. I must be missing something very simple here. In the past I have
hand coded all my asp.net code. Page code snippet below.
Thank you in advance for your help.
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents lResults As System.Web.UI.WebControls.Label
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Calendar1.SelectionChanged
If Calendar1.SelectedDates.Count = 1 Then
lResults.Text = Calendar1.SelectedDate
ElseIf Calendar1.SelectedDates.Count = 7 Then
lResults.Text = "Week of " & Calendar1.SelectedDate & " - " &
DateAdd(DateInterval.Day, 6, Calendar1.SelectedDate)
Else
lResults.Text = Format(Calendar1.SelectedDate, "MMMM") & " has " &
Calendar1.SelectedDates.Count.ToString & " days."
End If
End Sub
End Class