Click here to Skip to main content
15,908,020 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi good morning to all i am using ajax calendar and i want to display calendar to use user select only today's date and future date how can i display can anyone please tell me
Posted
Comments
Expert Coming 3-Dec-12 0:01am    
What have you tried? How does what you have tried not work?
[no name] 3-Dec-12 0:01am    
Why would you like to do that ?
Bitto kumar 3-Dec-12 0:05am    
hi my application my requirement is like that and my app is based on sales part so i have 2 validate user to select only 2days date

C#
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
    if (e.Day.Date < DateTime.Now.Date)
    {
        e.Day.IsSelectable = false;
    }
}
 
Share this answer
 
Comments
Tiwari Avinash 3-Dec-12 0:33am    
I think DayRender() is available only with asp:calender control and not with ajax calender extender.
Try this Link

http://www.ajaxcontroltoolkit.com/Calendar/Calendar.aspx[^]

It will definitely help you in Ajax Calendar.

Enjoy Coding. :)
 
Share this answer
 
v2
XML
<head runat="server">
    <title>Calendar Extender</title>
    <script type="text/javascript">
    function checkDate(sender,args)
{
 if (sender._selectedDate > new Date())
{
alert("You cannot select a day greater than today!");
sender._selectedDate = new Date();
// set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
    </script>
</head>




Use this script
XML
<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <cc1:CalendarExtender ID="CalendarExtender1"
        runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" />
    </div>
</form>



or explore more at
AJAX Calender Extender[^]
 
Share this answer
 
Hi Dear,


You can use asp .net calender control in that use DayRender() event to write the logic for your problem.

You can write it very easily....

all the best....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900