"Select Date from Appointment where Count(date)>=5"
I have to block all dates that I retrieved from DB in Calendar control. If I have to block a single date (eg: 28-6-2008), I can block that date by using the coding
if (e.Day.Date =='28-6-2008')
{
e.Day.IsSelecta ble = false;
e.Cell.BackColo r = System.Drawing. Color.Brown;
}
but the value retrieved from the DB will be the set of values like
Date
--------------------
28-6-2008
29-6-2008
30-6-2008
How can I block any of the selected set of dates in Calendar control during the page load
i dint get your question exactly , whether you want to block the dates in calender or the dates that you are quering from DB.
i dont think so there is option for blocking particular selected number of dates .
but you can , block all previous dates of a calender control from current date or all dates after the current date.
i dint get you problem correctly , hope this may help .
1.Allow the user to select any date from calander.
2.fetch the list of dates from database.
3.If the seelcted date is in the list of dates ,re-prompt the user to select date again with some meaningful message.
1.Allow the user to select any date from calander.
2.fetch the list of dates from database.
3.If the seelcted date is in the list of dates ,re-prompt the user to select date again with some meaningful message.
Hi
sorry for delay.
In ASP .Net calendar control, I have to block all dates which has count >=5 in DB during the page load
Even in asp.net or Win application you can block dates in a range or with some
condition. but why the DB comes in to pitcure, what is the actual relation of DB
and calender here , you are getting some integer value from DB and you want to
block dates depending on that value.can you please explain your project requirement.
Regards
nmsreddi
Hi
In my DB, I have the Appointment Table with the following columns
APID nvarchar(12)
USID nvarchar(12)
DRID nvarchar(12)
Date datetime
Brief Desc nvarchar(50)
Other Desc nvarchar(500)
Add by char(2)
Status char(1)
My requirement is the patients can fix an appointment to the doctors. If already appoints are fixed by an patients for more than 5 times, I have to block the date in calendar control by default in page load.
In my first form, if I click the Link Button named "Fix an Appointment", it should redirects to an Appointment.asp x page. Once if it redirects to the Appointment page, it should show a calendar with blocking of all previous dates and the date the appointment is fixed for more than 5 times.
Now i understand your problem , one possible way is you can check the availability by using day render event of calender control , but you are asking that should be done in page load it self ,its possible but you have go for a loop and have to check all the dates existing in the database, any way i will come up with a example code soon.
if you want to go in other way better use Day render event , it can solve your problem
Comment