Click here to Skip to main content
15,913,836 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
Hello Friends i am currently making one project of my uncle.
It's about dental clinic project
I have put online appointment facility in that but i have problem in appointment
[1]. Doctor take 2 day time to approve appointment status so while patient is selecting date patient can not select today and tomorrow date, how can i do using ajax time/date control
ex: if patient is taking appointment today on 6/4/2012 then patient can not select
6 and 7 april from picker, how to do this plz tell me
[2] in date picker , it show up to 2013 year limit not more then that.

Please help me
thanks in advance.
Posted
Updated 5-Apr-12 18:48pm
v2

for restricting the date to be selected you can use DayRender() event of Calendar control in ASP .net as:
C#
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
   {
       if (e.Day.Date > DateTime.Now.AddDays(1))
       {
           e.Day.IsSelectable = true;

       }
       else
       {
           e.Day.IsSelectable = false;
       }
   }

Or
have a look at the solutions provided in following pages you may get some idea :
http://forums.asp.net/p/1161833/2149277.aspx#2149277[^]
http://forums.asp.net/t/1319318.aspx[^]
 
Share this answer
 
v2
Use Following Code.

JavaScript Code :
JavaScript
function checkDate(sender, args)
        {

            var myDate = new Date();
            myDate.setDate(myDate.getDate() + 1);

            // Clear the time.
            myDate.setHours(0, 0, 0, 0);

            if (sender._selectedDate <=  new Date(myDate))
            {
                alert("You cannot select a day earlier than tomorrow !");
                sender._selectedDate = new Date(   myDate.setDate(myDate.getDate() + 1));
                // set the date back to the current date
                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }
        }


HTML Code:

ASP.NET
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>
            <cc1:calendarextender id="CalendarExtender1" xmlns:cc1="#unknown">
            runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" />
</cc1:calendarextender>


Hope it will work for you.
 
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