CALENDAR need help in ASP.NET

shalnark04

New member
Joined
Jan 8, 2010
Messages
3
Location
Manila
Programming Experience
1-3
Good day,

i have a application where a user must select a date. the problem is i want the selectable date is seven days from today.


example : Date.Today = jan 12, 2010

the selectable dates in the calendar is only from jan 19, 2010 onwards...

hope someone could give me some help.
 
I'm not aware of any functionality to limit this from the control, but you can validate selections and override them with SelectionChanged event. This example checks the single selected date and if it is earlier than one week ahead the first available date is selected instead:
VB.NET:
Dim d As Date = Date.Now.Date.AddDays(7)
If Me.Calendar1.SelectedDate < d Then
    Me.Calendar1.SelectedDate = d
End If
This example for multi-selection checks each selected date from high to low and removes any date earlier than one week ahead from the selection:
VB.NET:
Dim d As Date = Date.Now.Date.AddDays(7)
For ix As Integer = Me.Calendar1.SelectedDates.Count - 1 To 0 Step -1
    Dim sel As Date = Me.Calendar1.SelectedDates(ix)
    If sel < d Then
        Me.Calendar1.SelectedDates.Remove(sel)
    End If
Next
 
another Problem

how can i limit the calendar that the selectable dates are from 7 days from date today?... its almost the same problem as above but im using it now with my database..


hope someone could share their great knowledge and ideas...
 
Back
Top