动态创建向导控制完成按钮事件处理程序

时间:2018-06-18 18:06:15

标签: asp.net vb.net event-handling

        If CompsDateofSale.Rows.Count <> 0 Then
            'show modal window and creat controls
            datewizard.ID = "wizard1"
            datewizard.DisplayCancelButton = True

            'this is the code that doesnt seem to work!!!!!!!!!!!!!!!!!
            AddHandler datewizard.FinishButtonClick, AddressOf Wizard1FinishButton_Click
            'right above!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


            Dim newdatestep As New WizardStep



            For i = 1 To CompsDateofSale.Rows.Count
                Dim txtDate As New TextBox
                txtDate.ID = "txtStartDate" & CompsDateofSale.Rows(i - 1).Item("Comparable_Sale_Id")
                txtDate.Width = "150"
                txtDate.Enabled = True
                Dim calExt As New CalendarExtender
                calExt.ID = "CalendarExtender" & CompsDateofSale.Rows(i - 1).Item("Comparable_Sale_Id")
                calExt.Format = "MM/dd/yyyy"
                calExt.TargetControlID = txtDate.ID
                'add date
                calExt.SelectedDate = CompsDateofSale.Rows(i - 1).Item("_description").ToString
                newdatestep.ID = "datestep1"

                'newdatestep.Title = "Enter Dates"
                newdatestep.Controls.Add(New System.Web.UI.LiteralControl("Comparable" & CompsDateofSale.Rows(i - 1).Item("Comparable_Sale_Id")))
                newdatestep.Controls.Add(txtDate)
                newdatestep.Controls.Add(calExt)
                newdatestep.Controls.Add(New LiteralControl("<br />"))



            Next
            datewizard.WizardSteps.Add(newdatestep)
            PlaceHolder1.Controls.Add(datewizard)

            ModalPopupExtender1.Show()


        End If

我无法让addhandler行工作?我正在动态创建向导控件但在回发时事件不会触发。在page_load中我需要做些什么吗?我不在这里其他一切正常,我只需要在按下完成按钮时能够编码更多。

0 个答案:

没有答案