Calendar date blocking

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sweatha
    New Member
    • Mar 2008
    • 44

    Calendar date blocking

    Hi

    Can anybody help me how to block all dates in calendar control till the current date.
  • sweatha
    New Member
    • Mar 2008
    • 44

    #2
    Calendar date blocking

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

    Comment

    • cloud255
      Recognized Expert Contributor
      • Jun 2008
      • 427

      #3
      you could try the following:

      in the valueChanged event handler of your date picker control,

      if(datePicker.V alue < System.DateTime .Today)
      {
      datePicker.Valu e = System.DateTime .Today;
      }

      should work ok.

      good luck

      Comment

      • nmsreddi
        Contributor
        • Jul 2006
        • 366

        #4
        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

        Comment

        • nmsreddi
          Contributor
          • Jul 2006
          • 366

          #5
          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

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Using the MinDate property is a better option.

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

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

              Comment

              • sweatha
                New Member
                • Mar 2008
                • 44

                #8
                Originally posted by debasisdas
                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

                Comment

                • nmsreddi
                  Contributor
                  • Jul 2006
                  • 366

                  #9
                  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

                  Comment

                  • sweatha
                    New Member
                    • Mar 2008
                    • 44

                    #10
                    Originally posted by nmsreddi
                    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.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.


                    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.

                    Comment

                    • nmsreddi
                      Contributor
                      • Jul 2006
                      • 366

                      #11
                      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

                      Comment

                      Working...