Jore Posted November 22, 2005 Posted November 22, 2005 (edited) Hello! I'm trying to make the calendar control of asp.net to show week numbers. So far I have been able to produce correct week numbers (in Finland) and add them to the preferred first day of week cell. This is however very inconvenient because then the weeknumber goes between the first and the second day (monday and tuesday in Finland) or under the first day. Now I would like to have the weeknumber in the week selection cell where you can set a nonchangein value (SelectWeekText=""). Or If there is a way to add a cell to every week on the same row before the first weekday cell or the selectweek cell. Can anyone tell if this is possible? And how to do it if it is possible? Or is there any workarounds to show any data in a calendar control outside the day cells? Now I have a normal calendar control like '<asp:calendar ... onDayRender="Calendar_DayRender" ../>'. And here I have the week calculation. So I am now using the ondayrender to calculate the week number from the date, but I cant access week selection cell from there. Sub Calendar_DayRender(source As Object, e As DayRenderEventArgs) Dim d As CalendarDay d = e.Day ' Formatting the weeknumber into to calendar. If weekday(d.Date) = 2 Then ' Calculating the weeknumber for the calendar. Dim DayAmount As Integer = datediff("d", "1.1."&year(d.Date), dateadd("d",1,d.Date)) Dim ThisWeek As Integer Dim wkd As Integer = weekday("1.1."&year(d.date)) Select Wkd Case "1" DayAmount = DayAmount-1 'Sunday Case "2" DayAmount = DayAmount 'Monday Case "3" DayAmount = DayAmount+1 'Tuesday Case "4" DayAmount = DayAmount+2 'Wednesday Case "5" DayAmount = DayAmount+3 'Thurday Case "6" DayAmount = DayAmount-3 'Friday Case "7" DayAmount = DayAmount-2 'Saturday End Select ThisWeek = DayAmount / 7 + 1 e.Cell.HorizontalAlign = 1 e.Cell.Controls.Add(New LiteralControl(Thisweek)) End If End Sub Edited November 22, 2005 by Jore Quote
college_amy Posted November 30, 2005 Posted November 30, 2005 Yes it is possible. I have done it. Give me a bit and I will find my code. Will probably be late tonight or tomorrow before I can find it. (its at home and I am at work) I found my solution for this on the microsoft website. If that helps any. Quote
college_amy Posted November 30, 2005 Posted November 30, 2005 Here is a link to something that might help - will still look @ my code when I get home: http://www.basicdatepicker.com/documentation/BasicFrame.WebControls.BasicDatePicker.html uses a basicdatepicker but might help... Quote
college_amy Posted November 30, 2005 Posted November 30, 2005 Try this: ' Show the week numbers to the left of each week. Me.MonthCalendar1.ShowWeekNumbers = True found it here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsmonthcalendarclasstopic.asp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.