SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: .Net Calendar

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .Net Calendar

    Hi guys,

    Just a quick one.

    Does anyone know of a way to change the amount of days shown in a calendar month at the beginning and end of the month?

    The problem: If you take the time just to quickly drop the calendar control into a page then view OCT 2007 you will see that the 1st of October starts one whoel row down? Why do this? Why show 7 full days of September on the Oct month?

    I have taken a look at the various different properties I migth be able to set but nohting really seems to get rid of or change the amount of days shown from previous months and proceeding months.

    Any one know the solution to this one?

    Thanks,

    Tim

  2. #2
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    How about something like this:
    Code:
    <&#37;@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    <head>
    <style type="text/css">
    .hidden { visibility:hidden; }
    </style>
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <asp:calendar runat="server">
        <OtherMonthDayStyle
         CssClass="hidden" />
        </asp:calendar>
        </div>
        </form>
    </body>
    </html>

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    not really...

    Hi there,

    Thanks for the reply.

    Yep your correct in saying, that using

    Class Hidden
    e.g.

    Code:
    .hidden { display:none; }
    or using
    Code:
    .hidden { visibility:hidden; }
    and setting the calendars
    Code:
    OtherMonthDayStyle-CssClass="hidden"
    DOES hide the prev and next months days, though I would liek to control the amount of days from the month either side to display?

    Do you know how to go about doing that?

    Thanks,

    Tim

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The reason you see this is that most months start in the middle of the week, so typically you would only have a few days of September showing.

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    surely a .net calendar bug?

    Quote Originally Posted by wwb_99 View Post
    The reason you see this is that most months start in the middle of the week, so typically you would only have a few days of September showing.

    I can understand that, but in October 2007 it shows an entire week from the previous month?, and in other months shows an entire week from the next month dependant on when the calendar month starts.

    Surely this must be a .net calendar bug if you can't change the settings of how many days into the prev and next month you go?

    Thanks for the reply,

    Tim

  6. #6
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    More like minor design flaw, if that. Remember the calendar, like many of the more complex widgets, was made to give microsoft some stuff to drag-n-drop and demos and developers some quick and ugly control samples. Not to be your neato whizzbang production calendar. The 3rd party components definitely handle these cases better, so I would check them out if you absolutely need this functionality.

    As it is now, the calendar setup to hold six weeks (or rows in the table more properly) which is how many weeks one needs in cases where months bleed over in both directions. This is probably alot easier for developers to deal with in a generic control than something that resizes itself at whim.

  7. #7
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Strangely enough, when I drop a bone stock <asp:calendar> in it only gives me one day from September but November 1-10 is listed below October. :shrug:

    Still, entire extra week is not needed. I use the visibility:hidden all the time for this very reason.

  8. #8
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks you everyone for a great response on my posts.

    Helped clear up what I can and can't do with the calendar control.

    Tim


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •