Fiscal Calendar?

A

ajmera.puneet

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
 
G

Guest

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;
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top