CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Display Callerndar in a label

Print topic Send  topic

Author Message
gesto


Posts: 42
Posted: 11/16/2005, 10:13 AM

Many just want to display a calendar in the web page and canīt use the code in datepicker so here is a code sample ready to be used in your CCS page that you can manipulate as you wish.
Add a label field and set it to HTML
then in Beforeshow of this field add this code
  
dim Mes_ini, Mes_ini_dia, Mes_fin, Mes_fin_dia, Dia, Dia_Sem, i, Cont_Dia_Sem, Mes_Cal, Ano_Cal    
    
Mes_Cal = month(Date)    
Ano_cal = year(Date)    
    
    
'First Day of the month  
MEs_ini = "01/" & Mes_Cal & "/" & Ano_Cal    
Mes_ini_dia = 01    
    
'last day of the month    
Mes_Fin = DateAdd("d",-1,"01/" & month(Dateadd("m",1,Date)) & "/" & year(Dateadd("m",1,Date)))    
Mes_Fin_Dia = Day(Mes_fin)    
    
    
'open a table    
eventCaller.value = "<table class='gerencialFormTABLE'><tr align='center'>"    
    
'put the weekdays on top    
    
for i = 1 to 7    
eventCaller.value = eventCaller.value & "<td class='gerencialDataTD'><b>" & UCase(left(weekdayname(i),1)) & "</b></td>"    
next    
    
'set i to 0 to use it again    
i = 0    
    
eventCaller.value = eventCaller.value & "</tr><tr align='center'>"    
    
    
'begin of month loop    
for dia = mes_ini_dia to Mes_fin_dia step 1    
eventCaller.value = eventCaller.value & "<td class='gerencialDataTD'>"    
    
'see the weekday of the first day of the month    
if dia = 1 then    
Cont_Dia_Sem = weekday(CDate("0" & dia & "/" & Mes_Cal & "/" & Ano_Cal)) -1    
    
for i = 1 to Cont_Dia_Sem step 1    
eventCaller.value = eventCaller.value & " </td><td class='gerencialDataTD'>"    
next    
end if    
    
eventCaller.value = eventCaller.value & dia & " "    
    
'See the weekday of the month    
    
if dia <10 then    
Dia_Sem = weekday(CDate("0" & dia & "/" & Mes_Cal & "/" & Ano_Cal))    
Cont_Dia_Sem = Cont_Dia_Sem + 1    
else    
Dia_Sem = weekday(CDate(dia & "/" & Mes_Cal & "/" & Ano_Cal))    
Cont_Dia_Sem = Cont_Dia_Sem + 1    
end if    
    
'Add column    
eventCaller.value = eventCaller.value & "</td>"    
    
'if 7 days, change the line    
if Cont_Dia_Sem = 7 then    
    
eventCaller.value = eventCaller.value & "</tr><tr align='center'>"    
Cont_Dia_Sem = 0    
end if    
    
    
'next day    
next    
    
eventCaller.value = eventCaller.value & "</table>"  

and that's all... :-D
View profile  Send private message
peterr


Posts: 5971
Posted: 11/16/2005, 1:17 PM

gesto,
Thank you for posting tips. You may also consider posting it into the Tips & Solutions forum at http://forums.codecharge.com/forum.php?forum_id=25
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright Đ 2003-2004 by UltraApps.com  and YesSoftware, Inc.