473,383 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Calendar date blocking

44
Hi

Can anybody help me how to block all dates in calendar control till the current date.
Jun 27 '08 #1
10 1874
sweatha
44
Hi Experts

I have selected date from DB by using query

"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.IsSelectable = false;

e.Cell.BackColor = 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
Jun 27 '08 #2
cloud255
427 Expert 256MB
you could try the following:

in the valueChanged event handler of your date picker control,

if(datePicker.Value < System.DateTime.Today)
{
datePicker.Value = System.DateTime.Today;
}

should work ok.

good luck
Jun 27 '08 #3
nmsreddi
366 256MB
Hello

if its a windows application you can directly use MinDate property of the datetime picker.just assign min date as current date

dateTimePicker1.MinDate = System.DateTime.Now;

in web application we have java script calenders ,where we can directly strike out the passed dates .

better post application type and the excat control what you are using ,then its easy to give exact answer

Regards
nmsreddi
Jun 27 '08 #4
nmsreddi
366 256MB
Hello

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 .


Regards
nmsreddi
Jun 27 '08 #5
debasisdas
8,127 Expert 4TB
Using the MinDate property is a better option.
Jun 27 '08 #6
debasisdas
8,127 Expert 4TB
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.
Jun 27 '08 #7
sweatha
44
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
Jun 30 '08 #8
nmsreddi
366 256MB
Hello

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
Jun 30 '08 #9
sweatha
44
Hello

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.aspx 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.


In this appointment page, I have

1 Calendar control

Date: TextBox
Brief Desc: TextBox
Other Details: TextBox
Add By: TextBox
Status: TextBox

"Fix Appointment"- Button

Here the patient can enter the date,Brief Desc,etc and click the button to fix an appointment.
Jun 30 '08 #10
nmsreddi
366 256MB
Hello

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


Regards
nmsreddy
Jul 1 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: cg_news | last post by:
In short, what I am trying to do is, based on a date, calculate the week of year (as described in ISO 8601), then calculate the first and last date in this week period and return them in the format...
1
by: David Stockwell | last post by:
I''m wondering if the Calendar object has an option to only do calculations based on business days (ie M-F). Additionally does it have a way to get holidays into itself? Currently I'm...
10
by: vinu | last post by:
I have a javascript file named select.js. This is a file which is use to pop up a calendar, when clicked on a calendar icon in an ASP file. have a close button in the calendar. When i click on the...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
3
by: thorpk | last post by:
I posted this problem earlier in the month and some one decided it was better to change the subject and ask a completely different question. I am therefore reposting. I am hoping some one can...
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
2
by: suganya | last post by:
Hi I have to block all previous date in calendar. for that I have given coding as protected void QuickCalendar_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e) ...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.