Hi All, Hope someone can help!
I am building an Event Calendar app based around the Calendar
WebControl which builds an SQL string based on the SelectedDates
property which is passed to Page.StartDate and Page.EndDate
properties.
This works nicely and I can select a Day, Week or Month and run my SQL
against them.
There is also a shortcuts dropdown to allow the user to select Today,
Last Month, This Month, Next Month, Next Two Weeks, Next 30 Days, Next
60 Days, Next 90 Days.
Again, these all work nicely as I set the Page.StartDate and
Page.EndDate based on the option and run the SQL then update the
Calendar.VisibleDate to Page.StartDate.
The problem is it would be nice for the Calendar object to reflect the
shortcut ranges. This is OK for Today as I can just set the
SelectedDate to the Page.StartDate. However the SelectedDates property
is read only.
Is there any way to set a range of dates to be selected based on the
Page.StartDate and Page.EndDate properties?
Many TIA
--
Shevek
The Poster Previously Known As Moldy 3 3586
you can write a handler for DayRender event and check for the date and
change color accordingly.
private void Calendar1_DayRender(object
sender,System.Web.UI.WebControls.DayRenderEventArg s e )
{
if (e.Day.Date >= Page.StartDate && e.Day.Date <= Page.EndDate)
{
e.Cell.BackColor = System.Drawing.Color.LightGray;
}
}
hth,
Av.
"Shevek" <sh****************@moldy.me.uk> wrote in message
news:uk********************************@4ax.com... Hi All, Hope someone can help!
I am building an Event Calendar app based around the Calendar WebControl which builds an SQL string based on the SelectedDates property which is passed to Page.StartDate and Page.EndDate properties.
This works nicely and I can select a Day, Week or Month and run my SQL against them.
There is also a shortcuts dropdown to allow the user to select Today, Last Month, This Month, Next Month, Next Two Weeks, Next 30 Days, Next 60 Days, Next 90 Days.
Again, these all work nicely as I set the Page.StartDate and Page.EndDate based on the option and run the SQL then update the Calendar.VisibleDate to Page.StartDate.
The problem is it would be nice for the Calendar object to reflect the shortcut ranges. This is OK for Today as I can just set the SelectedDate to the Page.StartDate. However the SelectedDates property is read only.
Is there any way to set a range of dates to be selected based on the Page.StartDate and Page.EndDate properties?
Many TIA
--
Shevek
The Poster Previously Known As Moldy
On Wed, 23 Jun 2004 18:01:57 +0530, "avnrao" <av*@newsgroups.com>
wrote: you can write a handler for DayRender event and check for the date and change color accordingly.
private void Calendar1_DayRender(object sender,System.Web.UI.WebControls.DayRenderEventAr gs e ) { if (e.Day.Date >= Page.StartDate && e.Day.Date <= Page.EndDate) { e.Cell.BackColor = System.Drawing.Color.LightGray; } }
hth,
Doesn't quite work!
I already use the DayRender event to apply styles and onmouseover to
give the dates borders and rollovers.
If I change the first line to
If (e.Day.Date.ToShortDateString >= Me.StartDate And
e.Day.Date.ToShortDateString <= Me.EndDate) or e.Day.IsSelected Then
then it seems to keep the cssclass in the viewstate and is there when
I browse back and forth through the calendar....
If e.Day.IsSelected Then
If bEvent Then
e.Cell.ApplyStyle(ForeOrange)
e.Cell.CssClass = "EventSelectedDay"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'EventSelectedDayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'EventSelectedDay';")
Else
e.Cell.CssClass = "SelectedDay"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'SelectedDayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'SelectedDay';")
End If
ElseIf e.Day.IsWeekend Then
If bEvent Then
e.Cell.ApplyStyle(ForeOrange)
e.Cell.CssClass = "EventWeekendDay"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'EventWeekendDayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'EventWeekendDay';")
Else
e.Cell.CssClass = "WeekendDay"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'WeekendDayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'WeekendDay';")
End If
ElseIf e.Day.IsOtherMonth Then
If bEvent Then
e.Cell.ApplyStyle(ForeYellow)
e.Cell.CssClass = "EventOtherMonthDay"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'EventOtherMonthDayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'EventOtherMonthDay';")
Else
e.Cell.CssClass = "OtherMonthDay"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'OtherMonthDayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'OtherMonthDay';")
End If
Else
If bEvent Then
e.Cell.ApplyStyle(ForeOrange)
e.Cell.CssClass = "EventDay"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'EventDayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'EventDay';")
Else
e.Cell.CssClass = "Day"
e.Cell.Attributes.Add("onmouseover",
"javascript:this.className = 'DayOver';")
e.Cell.Attributes.Add("onmouseout",
"javascript:this.className = 'Day';")
End If
End IfAv.
"Shevek" <sh****************@moldy.me.uk> wrote in message news:uk********************************@4ax.com.. . Hi All, Hope someone can help!
I am building an Event Calendar app based around the Calendar WebControl which builds an SQL string based on the SelectedDates property which is passed to Page.StartDate and Page.EndDate properties.
This works nicely and I can select a Day, Week or Month and run my SQL against them.
There is also a shortcuts dropdown to allow the user to select Today, Last Month, This Month, Next Month, Next Two Weeks, Next 30 Days, Next 60 Days, Next 90 Days.
Again, these all work nicely as I set the Page.StartDate and Page.EndDate based on the option and run the SQL then update the Calendar.VisibleDate to Page.StartDate.
The problem is it would be nice for the Calendar object to reflect the shortcut ranges. This is OK for Today as I can just set the SelectedDate to the Page.StartDate. However the SelectedDates property is read only.
Is there any way to set a range of dates to be selected based on the Page.StartDate and Page.EndDate properties?
Many TIA
--
Shevek
The Poster Previously Known As Moldy
--
Shevek
The Poster Previously Known As Moldy
On Wed, 23 Jun 2004 13:59:38 +0100, Shevek
<sh****************@moldy.me.uk> wrote: On Wed, 23 Jun 2004 18:01:57 +0530, "avnrao" <av*@newsgroups.com> wrote:
you can write a handler for DayRender event and check for the date and change color accordingly.
private void Calendar1_DayRender(object sender,System.Web.UI.WebControls.DayRenderEventA rgs e ) { if (e.Day.Date >= Page.StartDate && e.Day.Date <= Page.EndDate) { e.Cell.BackColor = System.Drawing.Color.LightGray; } }
hth, Doesn't quite work!
I already use the DayRender event to apply styles and onmouseover to give the dates borders and rollovers.
If I change the first line to
If (e.Day.Date.ToShortDateString >= Me.StartDate And e.Day.Date.ToShortDateString <= Me.EndDate) or e.Day.IsSelected Then
then it seems to keep the cssclass in the viewstate and is there when I browse back and forth through the calendar....
Got it! It was not working because my Page.StartDate and Page.EndDate
are both dates stored as strings...
Dim dStartDate, dEndDate As Date
If IsDate(Me.StartDate) Then dStartDate = Me.StartDate
If IsDate(Me.EndDate) Then dEndDate = Me.EndDate
If (e.Day.Date >= dStartDate And e.Day.Date <= dEndDate) Then
....has fixed it!
Cheers!
If e.Day.IsSelected Then If bEvent Then e.Cell.ApplyStyle(ForeOrange) e.Cell.CssClass = "EventSelectedDay" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'EventSelectedDayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'EventSelectedDay';") Else e.Cell.CssClass = "SelectedDay" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'SelectedDayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'SelectedDay';") End If ElseIf e.Day.IsWeekend Then If bEvent Then e.Cell.ApplyStyle(ForeOrange) e.Cell.CssClass = "EventWeekendDay" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'EventWeekendDayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'EventWeekendDay';") Else e.Cell.CssClass = "WeekendDay" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'WeekendDayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'WeekendDay';") End If ElseIf e.Day.IsOtherMonth Then If bEvent Then e.Cell.ApplyStyle(ForeYellow) e.Cell.CssClass = "EventOtherMonthDay" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'EventOtherMonthDayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'EventOtherMonthDay';") Else e.Cell.CssClass = "OtherMonthDay" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'OtherMonthDayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'OtherMonthDay';") End If Else If bEvent Then e.Cell.ApplyStyle(ForeOrange) e.Cell.CssClass = "EventDay" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'EventDayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'EventDay';") Else e.Cell.CssClass = "Day" e.Cell.Attributes.Add("onmouseover", "javascript:this.className = 'DayOver';") e.Cell.Attributes.Add("onmouseout", "javascript:this.className = 'Day';") End If End IfAv.
"Shevek" <sh****************@moldy.me.uk> wrote in message news:uk********************************@4ax.com. .. Hi All, Hope someone can help!
I am building an Event Calendar app based around the Calendar WebControl which builds an SQL string based on the SelectedDates property which is passed to Page.StartDate and Page.EndDate properties.
This works nicely and I can select a Day, Week or Month and run my SQL against them.
There is also a shortcuts dropdown to allow the user to select Today, Last Month, This Month, Next Month, Next Two Weeks, Next 30 Days, Next 60 Days, Next 90 Days.
Again, these all work nicely as I set the Page.StartDate and Page.EndDate based on the option and run the SQL then update the Calendar.VisibleDate to Page.StartDate.
The problem is it would be nice for the Calendar object to reflect the shortcut ranges. This is OK for Today as I can just set the SelectedDate to the Page.StartDate. However the SelectedDates property is read only.
Is there any way to set a range of dates to be selected based on the Page.StartDate and Page.EndDate properties?
Many TIA
--
Shevek
The Poster Previously Known As Moldy
--
Shevek
The Poster Previously Known As Moldy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tim Graichen |
last post by:
Hello,
I am making use of the Active X calendar control (mscal.Calendar.7) in
several places in my main form, with the following code
Below is an example of the code I'm using for the...
|
by: TDIOwa |
last post by:
I have a form that has a specific date on it. I want to open another
form that has the Active Control Calendar on it. I want to open this
form to the specific date on the first form. I have...
|
by: Peter |
last post by:
Hi
Is it possible that in the asp.net calendar control the selected date would be by default current day. I mean that user would not have to click todays date if the user wants to pick it but...
|
by: Peer K |
last post by:
Hello,
This is driving me nuts! It's a bit hard to explain so please bare with me.
I have an ASP.NET page that uses the calendar control. I use DayRender
to set specific days selectable...
|
by: Jay |
last post by:
I had such good luck asking about a rich textbox control, that I will do the
same for a calendar control.
I want a calendar control (not a date picker) that will show day, week,
month, year...
|
by: tfsmag |
last post by:
i need to create a date range based on the current "shown" month on a
calendar control to query a database and populate a datagrid based on
that date range.
how can i retrieve the "shown" month...
|
by: niju |
last post by:
Hi all,
I am using a calendar control to populate date for users. However, I
need to stop users from selecting date from past. Is there a way to
populate calendar from DateTime.now onwards.Any...
|
by: Cong |
last post by:
Hi
I have two unbounded text boxes (startdate and enddate). If I
entered the date manually
I can can set validation for the text box for example
< date()
this will works but if I have a...
|
by: Bob |
last post by:
How do I show a calendar control or another appropriate control to pick a
date and time for a cell in a column in a datagridview?
Thanks for any help.
Bob
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |