NTurnbullJr
New member
When I place a stop at btnDropdown_Click, the debugger doesn’t stop there. So I am assuming the event is not firing when I click the button. How do I get it to fire?
Here is the code for the control.
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
'<DefaultProperty("Text"), ToolboxData("<{0}:CalendarDropdown runat=server></{0}:CalendarDropdown>")>
Public Class DCHD_CalendarDropdown
Inherits System.Web.UI.WebControls.WebControl
Dim _text As String
WithEvents txtDate As New TextBox
WithEvents btnDropdown As New Button
WithEvents calCalendar As New Calendar
<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
'Create control's appearance
Protected Overrides Sub CreateChildControls()
'Add the sub controls to this composite control
txtDate.Text = _text
Controls.Add(txtDate)
Controls.Add(btnDropdown)
'calCalendar.Style.Item("ZOrder") = 0
Controls.Add(calCalendar)
calCalendar.Visible = False
End Sub
Private Sub btnDropdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDropdown.Click
If calCalendar.Visible Then
calCalendar.Visible = False
Else
calCalendar.Visible = True
End If
End Sub
End Class
Here is the code for the control.
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
'<DefaultProperty("Text"), ToolboxData("<{0}:CalendarDropdown runat=server></{0}:CalendarDropdown>")>
Public Class DCHD_CalendarDropdown
Inherits System.Web.UI.WebControls.WebControl
Dim _text As String
WithEvents txtDate As New TextBox
WithEvents btnDropdown As New Button
WithEvents calCalendar As New Calendar
<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
'Create control's appearance
Protected Overrides Sub CreateChildControls()
'Add the sub controls to this composite control
txtDate.Text = _text
Controls.Add(txtDate)
Controls.Add(btnDropdown)
'calCalendar.Style.Item("ZOrder") = 0
Controls.Add(calCalendar)
calCalendar.Visible = False
End Sub
Private Sub btnDropdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDropdown.Click
If calCalendar.Visible Then
calCalendar.Visible = False
Else
calCalendar.Visible = True
End If
End Sub
End Class