A
Andy B
I have the following code inside the nextButton_Click event of a wizard
control. The main thing to be watching is the CreationDate variable. There
are 2 textboxes on step 1 that let the person type in a date and a time.
When they click next, everything is validated of course. By the time we get
to the select case statement, everything is valid. What happens is this:
1. Enter the date and time in the edit boxes on step 1 and click next.
2. Assuming they are valid dates and times, they show up in the titleText
property of a custom control in step 2. This works fine so far.
3. Click next to go to step 3 and the date is printed in the
AddNewsResultsLabel. For some wierd reson, the CreationDate variable has
lost its value in step 3. Does anybody know what is going on here?
I tried just about everything possible and still get the same results. Here
is the code for the click event below:
Protected Sub AddNewsWizard_NextButtonClick(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles
AddNewsWizard.NextButtonClick
Static CreationDate As Date
Select Case e.NextStepIndex
Case 1
CreationDate = CDate(DateTextBox.Text + " " + TimeTextBox.Text)
NewsItem.TitleText = "<h2>" + TitleTextBox.Text + "</h2><br />" +
CreationDate.ToString("f") + "<br />" + DescriptionTextBox.Text
Dim BodyLabel As Label =
DirectCast(NewsItem.FindControl("AddBodyPreviewLabel"), Label)
BodyLabel.Text = BodyTextBox.Text
Case 2
AddNewsResultsLabel.Text = CreationDate.ToString("f")
'Dim NewsHelper As New NewsManager()
'Dim AddNewsResults As Integer = NewsHelper.AddNewsArticle(CreationDate,
TitleTextBox.Text, DescriptionTextBox.Text, BodyTextBox.Text,
IsArchivedCheckBox.Checked)
'If (AddNewsResults = 1) Then
' AddNewsResultsLabel.Text = "The news article has been saved."
'End If
'If (AddNewsResults = 0) Then
' AddNewsResultsLabel.Text = "The news article wasn't saved."
'End If
End Select
End Sub
control. The main thing to be watching is the CreationDate variable. There
are 2 textboxes on step 1 that let the person type in a date and a time.
When they click next, everything is validated of course. By the time we get
to the select case statement, everything is valid. What happens is this:
1. Enter the date and time in the edit boxes on step 1 and click next.
2. Assuming they are valid dates and times, they show up in the titleText
property of a custom control in step 2. This works fine so far.
3. Click next to go to step 3 and the date is printed in the
AddNewsResultsLabel. For some wierd reson, the CreationDate variable has
lost its value in step 3. Does anybody know what is going on here?
I tried just about everything possible and still get the same results. Here
is the code for the click event below:
Protected Sub AddNewsWizard_NextButtonClick(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles
AddNewsWizard.NextButtonClick
Static CreationDate As Date
Select Case e.NextStepIndex
Case 1
CreationDate = CDate(DateTextBox.Text + " " + TimeTextBox.Text)
NewsItem.TitleText = "<h2>" + TitleTextBox.Text + "</h2><br />" +
CreationDate.ToString("f") + "<br />" + DescriptionTextBox.Text
Dim BodyLabel As Label =
DirectCast(NewsItem.FindControl("AddBodyPreviewLabel"), Label)
BodyLabel.Text = BodyTextBox.Text
Case 2
AddNewsResultsLabel.Text = CreationDate.ToString("f")
'Dim NewsHelper As New NewsManager()
'Dim AddNewsResults As Integer = NewsHelper.AddNewsArticle(CreationDate,
TitleTextBox.Text, DescriptionTextBox.Text, BodyTextBox.Text,
IsArchivedCheckBox.Checked)
'If (AddNewsResults = 1) Then
' AddNewsResultsLabel.Text = "The news article has been saved."
'End If
'If (AddNewsResults = 0) Then
' AddNewsResultsLabel.Text = "The news article wasn't saved."
'End If
End Select
End Sub