Fiscal Calendar?

Discussion in 'ASP .Net' started by ajmera.puneet@gmail.com, Jul 31, 2006.

  1. Guest

    If I have Calendar Control on Asp.net page and I have a table for
    Fiscal years on sql server
    then, How can I check the dates from table to Calendar Control,so that
    I can format the Calendar control cells according to my need.
    I want to change the color of Dates according to fiscal month. i.e. As
    Calendar control has dates for Current + next + Previous months, I need

    to change the color of dates of month which is comes under Fiscal
    month.
    I have table for fiscal years, which has following :

    CREATE TABLE [AccountingCalendar] (
    [AccountingCalendarID] [int] IDENTITY (1, 1) NOT NULL ,
    [FiscalYear] [smallint] NOT NULL ,
    [FiscalQuarter] [tinyint] NOT NULL ,
    [FiscalMonth] [tinyint] NOT NULL ,
    [MonthName] [varchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS
    NOT
    NULL ,
    [MonthStart] [smalldatetime] NOT NULL ,
    [MonthEnd] [smalldatetime] NOT NULL ,
    [CalendarYear] [smallint] NOT NULL ,
    [CalendarQuarter] [tinyint] NOT NULL ,
    [CalendarMonth] [tinyint] NOT NULL ,
    [NoOfWeeks] [tinyint] NOT NULL ,
    CONSTRAINT [pkAccountingCalendar] PRIMARY KEY CLUSTERED
    (
    [AccountingCalendarID]
    ) WITH FILLFACTOR = 90 ON [PRIMARY]
    ) ON [PRIMARY]
    GO


    And data according to it.
    Now How can I check the dates from these table with Calendar Date and
    change the backgrond color for the month Started from MonthStart to
    MonthEnd field of table.


    Any suggestion or help will be appriciated.
    TIA
     
    , Jul 31, 2006
    #1
    1. Advertising

  2. Hello TIA,

    From your question I am assuming you want to color the background of each
    day depending upon some criteria. In order to do that you will want to create
    an event handler for the Calendar control's DayRender event. In your code,
    get the data from SQL into some in-memory datastore (DataTable probably in
    the PageLoad event). Then, in the DayRender event handler query the in-memory
    datastore against the DayRenderEventArg e.Day and set the e.Cell.BackColor
    appropriately. Something like this pseudocode:

    private void calBigMarathon_DayRender(object sender,
    System.Web.UI.WebControls.DayRenderEventArgs e)
    {
    if (e.Day.Date.DayOfYear == dtFiscal.Solvent)
    {
    set e.Cell.BackColor = black;
    }
    else
    {
    set e.Cell.BackColor = red;
    }
    }

    --
    enjoy - brians
    http://www.limbertech.com


    "" wrote:

    > If I have Calendar Control on Asp.net page and I have a table for
    > Fiscal years on sql server
    > then, How can I check the dates from table to Calendar Control,so that
    > I can format the Calendar control cells according to my need.
    > I want to change the color of Dates according to fiscal month. i.e. As
    > Calendar control has dates for Current + next + Previous months, I need
    >
    > to change the color of dates of month which is comes under Fiscal
    > month.
    > I have table for fiscal years, which has following :
    >
    > CREATE TABLE [AccountingCalendar] (
    > [AccountingCalendarID] [int] IDENTITY (1, 1) NOT NULL ,
    > [FiscalYear] [smallint] NOT NULL ,
    > [FiscalQuarter] [tinyint] NOT NULL ,
    > [FiscalMonth] [tinyint] NOT NULL ,
    > [MonthName] [varchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NOT
    > NULL ,
    > [MonthStart] [smalldatetime] NOT NULL ,
    > [MonthEnd] [smalldatetime] NOT NULL ,
    > [CalendarYear] [smallint] NOT NULL ,
    > [CalendarQuarter] [tinyint] NOT NULL ,
    > [CalendarMonth] [tinyint] NOT NULL ,
    > [NoOfWeeks] [tinyint] NOT NULL ,
    > CONSTRAINT [pkAccountingCalendar] PRIMARY KEY CLUSTERED
    > (
    > [AccountingCalendarID]
    > ) WITH FILLFACTOR = 90 ON [PRIMARY]
    > ) ON [PRIMARY]
    > GO
    >
    >
    > And data according to it.
    > Now How can I check the dates from these table with Calendar Date and
    > change the backgrond color for the month Started from MonthStart to
    > MonthEnd field of table.
    >
    >
    > Any suggestion or help will be appriciated.
    > TIA
    >
    >
     
    =?Utf-8?B?YnJpYW5zW01DU0Rd?=, Aug 1, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason

    Re: Calendar Control

    Jason, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,425
    Jason
    Jun 26, 2003
  2. Shevek
    Replies:
    3
    Views:
    6,103
    Shevek
    Jun 23, 2004
  3. Replies:
    0
    Views:
    929
  4. Shevek
    Replies:
    0
    Views:
    417
    Shevek
    Jun 23, 2004
  5. Parthiv Joshi
    Replies:
    1
    Views:
    776
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page