Hi Mudassirk7,
If you simply want to enable only next 6 days from current date then you can set property StartDate to Current Date value and EndDate to the date value till you want to enable the dates.
If you want to enable only particular weekday then you could only workaround by alerting the user if he/she tries to select anything else than a Sunday or some other weekday. In sample i have considered sunday as weekday.
I have created a sample for above both requirements you need to modify the code according to your need.
HTML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="cc1" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<div align="center">
<div>
Enabling One week Dates from Current Date.<br />
Date:-
<asp:TextBox ID="txtDate" runat="server" />
<cc1:CalendarExtender ID="Calendar1" Enabled="true" runat="server" TargetControlID="txtDate"
Format="dd/MM/yyyy">
</cc1:CalendarExtender>
</div>
<br />
<div>
Enabling Only Sundays.<br />
Date:-
<asp:TextBox ID="txtSunday" runat="server" />
<cc1:CalendarExtender ID="CalendarExtender1" Enabled="true" runat="server" TargetControlID="txtSunday"
Format="dd/MM/yyyy" OnClientDateSelectionChanged="checkDate">
</cc1:CalendarExtender>
<div>
<script type="text/javascript">
function checkDate(sender, args) {
if (sender._selectedDate.getDay() != 6) {
alert("You can only select Sundays!");
var txtDueDate = document.getElementById('<%=txtSunday.ClientID %>');
txtDueDate.value = '';
}
}
</script>
</div>
</div>
</div>
</form>
</body>
</html>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Calendar1.StartDate = DateTime.Now;
Calendar1.EndDate = DateTime.Now.AddDays(7);
}
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Calendar1.StartDate = DateTime.Now
Calendar1.EndDate = DateTime.Now.AddDays(7)
End If
End Sub
ScreenShot
