473,386 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Weekly view for Calendar control or 3rd Party component

Hello.

I am using the ASP.NET calendar object and am looking to provide a "weekly
view", but not the typical "Outlook" style. Rather, I just want it to render
the calendar normally, but only display the current week and not any of the
other weeks within the given month.

If this isn't possible with the built-in component, has anyone else solved
this issue with a third party component?

Thanks in advance.
Apr 3 '06 #1
2 2357
Hi Brenden,

I'm not sure if this is what you're after, but it was a fun little project.

If it's what you're after, let us know?

Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim dt As DateTime
dt = Now
Calendar1.VisibleDate = dt
Calendar1.SelectedDate = dt
End Sub

Public Shared Function Week _
(ByVal tdDate As System.DateTime) As Integer
Dim myCI As New Globalization.CultureInfo("en-US")
Dim myCal As Globalization.Calendar = myCI.Calendar
Dim myCWR As Globalization.CalendarWeekRule = _
myCI.DateTimeFormat.CalendarWeekRule
Dim myFirstDOW As DayOfWeek = _
myCI.DateTimeFormat.FirstDayOfWeek
Return myCal.GetWeekOfYear(tdDate, myCWR, myFirstDOW)
End Function

Protected Sub Calendar1_DayRender _
(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
If Week(e.Day.Date) <> Week(Calendar1.SelectedDate) Then
e.Cell.Text = ""
End If
End Sub


</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:calendar id="Calendar1" runat="server"
ondayrender="Calendar1_DayRender"></asp:calendar>

</div>
</form>
</body>
</html>

"Brenden Bixler" <Br***********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
Hello.

I am using the ASP.NET calendar object and am looking to provide a "weekly
view", but not the typical "Outlook" style. Rather, I just want it to
render
the calendar normally, but only display the current week and not any of
the
other weeks within the given month.

If this isn't possible with the built-in component, has anyone else solved
this issue with a third party component?

Thanks in advance.

Apr 3 '06 #2
Thank you Ken.

That was what I was trying to achieve. I should be able to modify your
example to meet my needs.

Much appreciated.

-Brenden

"Ken Cox - Microsoft MVP" wrote:
Hi Brenden,

I'm not sure if this is what you're after, but it was a fun little project.

If it's what you're after, let us know?

Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim dt As DateTime
dt = Now
Calendar1.VisibleDate = dt
Calendar1.SelectedDate = dt
End Sub

Public Shared Function Week _
(ByVal tdDate As System.DateTime) As Integer
Dim myCI As New Globalization.CultureInfo("en-US")
Dim myCal As Globalization.Calendar = myCI.Calendar
Dim myCWR As Globalization.CalendarWeekRule = _
myCI.DateTimeFormat.CalendarWeekRule
Dim myFirstDOW As DayOfWeek = _
myCI.DateTimeFormat.FirstDayOfWeek
Return myCal.GetWeekOfYear(tdDate, myCWR, myFirstDOW)
End Function

Protected Sub Calendar1_DayRender _
(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
If Week(e.Day.Date) <> Week(Calendar1.SelectedDate) Then
e.Cell.Text = ""
End If
End Sub


</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:calendar id="Calendar1" runat="server"
ondayrender="Calendar1_DayRender"></asp:calendar>

</div>
</form>
</body>
</html>

"Brenden Bixler" <Br***********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
Hello.

I am using the ASP.NET calendar object and am looking to provide a "weekly
view", but not the typical "Outlook" style. Rather, I just want it to
render
the calendar normally, but only display the current week and not any of
the
other weeks within the given month.

If this isn't possible with the built-in component, has anyone else solved
this issue with a third party component?

Thanks in advance.


Apr 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: fig000 | last post by:
Hi, I have an application that's running fine on development servers (web and database-sql server 2000). I'm updating a record through a third party component but I don't think the component...
1
by: Norman Fritag | last post by:
Hi there I have avoided to use active x controls because I thought they are causing more problems then they are doing any good. I a new application I would want to use the tree and list view...
3
by: Luis E Valencia | last post by:
I have a table that says for example 01/05/2004 Party IIsadpaks 01/06/2004 Party 2394923423 A events table. I want to make a calendar and that the days that are events are inbold and with...
0
by: maxrawson | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
5
by: Peter | last post by:
Is it possible to span / display a graphic in the web calendar control that spans more than one cell / day? Does anyone have an example of this? Thanks Peter
2
by: Paul | last post by:
I am using the standard Calendar control in ASP.Net 2.0 and VB.Net and VS2005. Here is the code: <asp:calendar id="cldr_contract_date" runat="server" backcolor="#ffffff" width="250px"...
1
by: Paul H | last post by:
Can anyone give me some pointers as to how to construct a form or forms that will allow me to see a schedule of meeting rooms Booked or Available as a nice visual display. The Query that holds the...
1
by: swethak | last post by:
hi, i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.