Public Class Sample10
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Set miminum allowable date to Today.
BasicDatePicker1.MinimumDate = DateTime.Today
' Create image tag for footer message.
Dim footerText As String = ""
footerText += "<img src='/aspnet_client/basicframe_webcontrols_basicdatepicker/1_1_1896/information.gif' width='17' height='17' alt='' align='absmiddle' /> "
If Not BasicDatePicker1.IsNull Then
footerText += "Last date selected was:<br />"
footerText += String.Format("{0:MMM dd, yyyy}", BasicDatePicker1.SelectedDate)
If BasicDatePicker1.SelectedDate = DateTime.Today Then
footerText += " (Today)"
End If
Else
footerText += "Weekdays only."
End If
BasicDatePicker1.FootNoteText = footerText
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.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 DateTime object could also be converted to a String manually.
labelText = String.Format("{0:MMM dd, yyyy}", BasicDatePicker1.SelectedDate)
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 BasicDatePicker1 As BasicFrame.WebControls.BasicDatePicker
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
End Class