Hi - I'm having a strange problem. I'm trying to populate a dropdown list, held in "Step 2" of a asp:Wizard. The code is shown below. But the script ditches out at the items.add line. Any ideas what might be wrong?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub OnFinishButtonClick(ByVal sender As [Object], ByVal e As WizardNavigationEventArgs)
Response.Redirect("http://www.bbc.co.uk")
End Sub
Protected Sub OnGoBackButtonClick(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub OnActiveStepChanged(ByVal sender As Object, ByVal e As EventArgs)
If SignUpWizard.ActiveStep.ID = "Step2" Then
Dim theMonth As New DropDownList
theMonth = SignUpWizard.FindControl("DoBMonth")
theMonth.Items.Add(New ListItem("January", "January")) <<<<<<<<<<<<<<<<<<< crashes here
End If
End Sub
Question
i11usive
Hi - I'm having a strange problem. I'm trying to populate a dropdown list, held in "Step 2" of a asp:Wizard. The code is shown below. But the script ditches out at the items.add line. Any ideas what might be wrong?
<asp:Wizard ID="SignUpWizard" runat="server" onfinishbuttonclick="OnFinishButtonClick" onactivestepchanged="OnActiveStepChanged" DisplaySideBar="false" EnableTheming="True"> <WizardSteps> <asp:TemplatedWizardStep ID="Intro" runat="server"> <ContentTemplate>blah</ContentTemplate> </asp:TemplatedWizardStep> <asp:TemplatedWizardStep ID="Step2" runat="server"> <asp:Dropdownlist ID="DoBMonth" runat="server" /> </asp:TemplatedWizardStep>Code behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub OnFinishButtonClick(ByVal sender As [Object], ByVal e As WizardNavigationEventArgs) Response.Redirect("http://www.bbc.co.uk") End Sub Protected Sub OnGoBackButtonClick(ByVal sender As Object, ByVal e As EventArgs) End Sub Protected Sub OnActiveStepChanged(ByVal sender As Object, ByVal e As EventArgs) If SignUpWizard.ActiveStep.ID = "Step2" Then Dim theMonth As New DropDownList theMonth = SignUpWizard.FindControl("DoBMonth") theMonth.Items.Add(New ListItem("January", "January")) <<<<<<<<<<<<<<<<<<< crashes here End If End SubEdited by AntarisAdded code blocks
Link to comment
Share on other sites
3 answers to this question
Recommended Posts