Imports BasicFrame.WebControls
Public Class Sample11
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 BasicDatePicker1 As BasicFrame.WebControls.BasicDatePicker
Protected WithEvents SpecialDates1 As BasicFrame.WebControls.SpecialDates
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents btnSpecialDates As System.Web.UI.WebControls.LinkButton
Protected WithEvents lblSpecialDates 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
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(-16), "Presentation with Partners.", True, String.Empty))
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(-2), "Holiday", False, String.Empty))
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(-1), "Review customer agreements.", True, String.Empty))
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(1), "Follow-up new sales.", True, String.Empty))
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(1), "Lunch with Sales department.", True, String.Empty))
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(4), "Send final version of customer agreements.", True, String.Empty))
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(5), "Holiday", False, String.Empty))
Me.SpecialDates1.Dates.Add(New SpecialDate(DateTime.Today.AddDays(14), "Closed", False, "bdpSpecialDateLite"))
'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
'Put user code to initialize the page here
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 = this.BasicDatePicker1.SelectedDateFormatted;
' Option #2
' The SelectedDate could also be converted to a String manually.
labelText = Me.BasicDatePicker1.SelectedDate.ToString("MMMM dd, yyyy")
Else
labelText = "No Date."
End If
' Check to determine if the SelectedDate is contained in the SpecialDates Collection.
If Me.SpecialDates1.Dates.Contains(Me.BasicDatePicker1.SelectedDate) Then
labelText += "<br />This is a SpecialDate"
Else
labelText += "<br />This is <strong>NOT</strong> a SpecialDate"
End If
Label1.Text = "You picked: <strong>" + labelText + "</strong>"
End Sub
Private Sub btnSpecialDates_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpecialDates.Click
' If any SpecialDate object exist, then print list to screen.
If Me.SpecialDates1.Dates.Count > 0 Then
Dim temp As String = String.Empty
Dim specialDate As specialDate
For Each specialDate In Me.SpecialDates1.Dates
temp += specialDate.Date.ToLongDateString() + " - " + specialDate.Text + "<br />"
Next
Me.lblSpecialDates.Text = temp
End If
End Sub
End Class