Public Class Sample14
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents BDPLite1 As BasicFrame.WebControls.BDPLite
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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
If Not IsPostBack Then
' Set SelectedDate to Today.
Me.BDPLite1.SelectedDate = DateTime.Today
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim labelText As String = String.Empty
' Check to see if DateTime object isNull (DateTime.MinValue).
If Not Me.BDPLite1.IsNull Then
' Option #1
' .SelectedDateFormatted automatically converts the SelectedDate
' to a string and formats according to the DateFormat.
labelText = BDPLite1.SelectedDateFormatted
' Option #2
' The SelectedDate could also be converted to a String manually.
' labelText = BasicDatePicker1.SelectedDate.ToShortDateString();
Else
labelText = "No Date."
End If
Label1.Text = "You picked: <strong>" + labelText + "</strong>"
End Sub
End Class