Public Class Sample2
Inherits System.Web.UI.Page
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.
BasicDatePicker1.SelectedDate = DateTime.Today
End If
End Sub
Private Sub BasicDatePicker1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BasicDatePicker1.SelectionChanged
Dim labelText As String = String.Empty
' Check to see if DateTime object isNull (DateTime.MinValue).
If Not Me.BasicDatePicker1.IsNull Then
' Option #1
' .SelectedDateFormatted automatically converts the SelectedDate to a string and formats according to the DateFormat.
labelText = BasicDatePicker1.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
#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 Label1 As System.Web.UI.WebControls.Label
Protected WithEvents BasicDatePicker1 As BasicFrame.WebControls.BasicDatePicker
'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
End Class