473,321 Members | 1,877 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,321 software developers and data experts.

calendar SelectionChanged

I have a basic calendar and a SelectionChanged event (asp.net 2.0).

How can I handle it when a user chooses the same date again, in this case
the SelectionChanged event is not fired because, well, the date selected
hasnt changed.

Is there a calendar.clearSelection type method on the calendar I can use?
Mar 20 '07 #1
24 9631
"NH" <NH@discussions.microsoft.comwrote in message
news:40**********************************@microsof t.com...
>I have a basic calendar and a SelectionChanged event (asp.net 2.0).

How can I handle it when a user chooses the same date again, in this case
the SelectionChanged event is not fired because, well, the date selected
hasnt changed.
That's absolutely right...
Is there a calendar.clearSelection type method on the calendar I can use?
What are you trying to do...? What do you want to happen if the user clicks
the calendar but the selection hasn't changed...?
Mar 20 '07 #2
All I am doing is placing the selected date into a textbox. It is a data
entry screen so sometimes the selected date will be the same as the last one.

Any way of handling this? I thought this would be a common problem.

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:40**********************************@microsof t.com...
I have a basic calendar and a SelectionChanged event (asp.net 2.0).

How can I handle it when a user chooses the same date again, in this case
the SelectionChanged event is not fired because, well, the date selected
hasnt changed.

That's absolutely right...
Is there a calendar.clearSelection type method on the calendar I can use?

What are you trying to do...? What do you want to happen if the user clicks
the calendar but the selection hasn't changed...?
Mar 20 '07 #3
"NH" <NH@discussions.microsoft.comwrote in message
news:F9**********************************@microsof t.com...
All I am doing is placing the selected date into a textbox. It is a data
entry screen so sometimes the selected date will be the same as the last
one.

Any way of handling this? I thought this would be a common problem.
I'm clearly not grasping the problem here...

You have a textbox and, presumably, a button or something which pops the
calendar, right...?

The user clicks a date, and the textbox is updated, right...?

At this point, don't you close the calendar...?
Mar 20 '07 #4
yes correct, I might be in the wrong forum. I should have added that I am
using ms ajax 1.0 and the calendar closes down fine. I kinda assumed this was
the same behaviour for non ajax apps.

So this works fine after the page postbacks?

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:F9**********************************@microsof t.com...
All I am doing is placing the selected date into a textbox. It is a data
entry screen so sometimes the selected date will be the same as the last
one.

Any way of handling this? I thought this would be a common problem.

I'm clearly not grasping the problem here...

You have a textbox and, presumably, a button or something which pops the
calendar, right...?

The user clicks a date, and the textbox is updated, right...?

At this point, don't you close the calendar...?
Mar 20 '07 #5
"NH" <NH@discussions.microsoft.comwrote in message
news:47**********************************@microsof t.com...
yes correct, I might be in the wrong forum. I should have added that I am
using ms ajax 1.0 and the calendar closes down fine. I kinda assumed this
was
the same behaviour for non ajax apps.

So this works fine after the page postbacks?
Apologies again - am still not grasping the problem...

If the calendar closes when the user selects a date, then how are they able
to click the date again...?
Mar 20 '07 #6
Sorry for the confusion.

Step 1:
User selects a date from the pop up and the date is put into a textbox using
the selectionChange event of the calendar. Calendar closes.

Step 2:
Do the same thing again and choose the same date you chose in first step.
The selectionChange event does not fire (as expected). So how can I clear the
selection or make the event fire.

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:47**********************************@microsof t.com...
yes correct, I might be in the wrong forum. I should have added that I am
using ms ajax 1.0 and the calendar closes down fine. I kinda assumed this
was
the same behaviour for non ajax apps.

So this works fine after the page postbacks?

Apologies again - am still not grasping the problem...

If the calendar closes when the user selects a date, then how are they able
to click the date again...?
Mar 20 '07 #7
"NH" <NH@discussions.microsoft.comwrote in message
news:D2**********************************@microsof t.com...
Sorry for the confusion.

Step 1:
User selects a date from the pop up and the date is put into a textbox
using
the selectionChange event of the calendar. Calendar closes.

Step 2:
Do the same thing again and choose the same date you chose in first step.
The selectionChange event does not fire (as expected). So how can I clear
the
selection or make the event fire.
Ah... Please post your code...
Mar 20 '07 #8
here is a very simple example of the issue.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb"
Inherits="test" %>

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

<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"></asp:Calendar>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>

Code behind:

Partial Class test
Inherits System.Web.UI.Page

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Calendar1.SelectionChanged
TextBox1.Text = Calendar1.SelectedDate
End Sub
End Class

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:D2**********************************@microsof t.com...
Sorry for the confusion.

Step 1:
User selects a date from the pop up and the date is put into a textbox
using
the selectionChange event of the calendar. Calendar closes.

Step 2:
Do the same thing again and choose the same date you chose in first step.
The selectionChange event does not fire (as expected). So how can I clear
the
selection or make the event fire.

Ah... Please post your code...
Mar 20 '07 #9
"NH" <NH@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
here is a very simple example of the issue.
But I don't think that's the problem... Do you not have more code than this
e.g. a DayRender method which disables the SelectedDate or something when
the Calendar is opened...?
Mar 20 '07 #10
One option here, though I know it may not be what you're looking for, is to
have a button to set the date in the textbox, using the selected date in the
calendar
Other than that - when the calendar pops up, you could set the selected date
of the calendar to an alternate date....then, the selectionchanged event
would fire via their selection...

(just throwing out ideas here)

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"NH" <NH@discussions.microsoft.comwrote in message
news:40**********************************@microsof t.com...
I have a basic calendar and a SelectionChanged event (asp.net 2.0).

How can I handle it when a user chooses the same date again, in this case
the SelectionChanged event is not fired because, well, the date selected
hasnt changed.

Is there a calendar.clearSelection type method on the calendar I can use?

Mar 20 '07 #11
"David Wier" <da********@noSpamhotmail.comwrote in message
news:OK**************@TK2MSFTNGP03.phx.gbl...
Other than that - when the calendar pops up, you could set the selected
date
of the calendar to an alternate date....then, the selectionchanged event
would fire via their selection...
I usually don't do that - instead, I use the VisibleDate property to make
sure the Calendar displays the correct month, and then the DayRender event
to highlight the "associated" date in some way e.g. setting the BackColor to
Grey or something...

http://msdn2.microsoft.com/en-us/lib...te(VS.80).aspx
Mar 20 '07 #12
How do you disable the selected date when the calendar opens?

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
here is a very simple example of the issue.

But I don't think that's the problem... Do you not have more code than this
e.g. a DayRender method which disables the SelectedDate or something when
the Calendar is opened...?
Mar 21 '07 #13
"NH" <NH@discussions.microsoft.comwrote in message
news:23**********************************@microsof t.com...
"Mark Rae" wrote:
>"NH" <NH@discussions.microsoft.comwrote in message
news:89**********************************@microso ft.com...
here is a very simple example of the issue.

But I don't think that's the problem... Do you not have more code than
this
e.g. a DayRender method which disables the SelectedDate or something when
the Calendar is opened...?
Please don't top-post...
How do you disable the selected date when the calendar opens?
http://www.google.co.uk/search?sourc...ndar+DayRender

Mar 21 '07 #14
"NH" <NH@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
here is a very simple example of the issue.
<snip>

Is this the entire code for the the page in question...?
Mar 21 '07 #15
There is other code on the page, but its not related to the issue.

So I think you understand the issue? Do you know how to disable the
previously selected date when using the calendar on subsequent times.

You mentioned you disable the selected date in the dayRender method, what is
the code for that?

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
here is a very simple example of the issue.

<snip>

Is this the entire code for the the page in question...?
Mar 21 '07 #16
"NH" <NH@discussions.microsoft.comwrote in message
news:61**********************************@microsof t.com...

Please stop top-posting - it is very irritating...
There is other code on the page, but its not related to the issue.
Are you sure...?
So I think you understand the issue? Do you know how to disable the
previously selected date when using the calendar on subsequent times.
When you open a calendar, it doesn't have a selected date until you set its
SelectedDate property.

Create a completely new aspx page and put the following markup in it:

<asp:Calendar ID="calTest" runat="server" />

Now open the page and click the same date over and over again - no problem,
right...?

You say that you are able to click a date the first time the calendar is
opened but, when you open it a second time, you are unable to click the same
date.

This won't happen by itself - you must be doing it...

You say that the calendar is associated with a text box - how is it
associated with a text box...?
Mar 21 '07 #17
Top posting? What?

Anyways, so on the new page you created below you have added a calendar.
Thats fine. Now add a text box to the same page. Now add a
calendar.SelectionChange, something like this...

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Calendar1.SelectionChanged
TextBox1.Text = Calendar1.SelectedDate
End Sub
End Class

So choose a date from the calendar and the date goes into the textbox as a
result of the code above. Now clear out the textbox and choose the same date
again from the calendar. As the selected date has not changed the
calendar.selectionChanged event doesnt not fire as expected.

So how can you remove the previous selected date or make the
selectionChanege veent fire. Do you see the problem?

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:61**********************************@microsof t.com...

Please stop top-posting - it is very irritating...
There is other code on the page, but its not related to the issue.

Are you sure...?
So I think you understand the issue? Do you know how to disable the
previously selected date when using the calendar on subsequent times.

When you open a calendar, it doesn't have a selected date until you set its
SelectedDate property.

Create a completely new aspx page and put the following markup in it:

<asp:Calendar ID="calTest" runat="server" />

Now open the page and click the same date over and over again - no problem,
right...?

You say that you are able to click a date the first time the calendar is
opened but, when you open it a second time, you are unable to click the same
date.

This won't happen by itself - you must be doing it...

You say that the calendar is associated with a text box - how is it
associated with a text box...?
Mar 21 '07 #18
"NH" <NH@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
Top posting? What?
Top posting... Placing your reply *above* the post you're replying to
instead of *below* it... Generally considered bad netiquette...
A - Because it interrupts the normal way of reading conversations i.e. from
start to finish

Q - Why is top posting irritating...?

So how can you remove the previous selected date
Calendar1.SelectedDate = Nothing
Mar 21 '07 #19
Thats not correct, I was replying to your earlier post. You had replied to
somebody else i.e. David.

Which event have you put the Calendar1.SelectedDate = Nothing into ?

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
Top posting? What?

Top posting... Placing your reply *above* the post you're replying to
instead of *below* it... Generally considered bad netiquette...
A - Because it interrupts the normal way of reading conversations i.e. from
start to finish

Q - Why is top posting irritating...?

So how can you remove the previous selected date

Calendar1.SelectedDate = Nothing
Mar 21 '07 #20

"NH" <NH@discussions.microsoft.comwrote in message
news:BF**********************************@microsof t.com...
Thats not correct, I was replying to your earlier post. You had replied to
somebody else i.e. David.
FWIW, you're still top posting...
Which event have you put the Calendar1.SelectedDate = Nothing into ?
The one you mentioned:

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Calendar1.SelectionChanged
TextBox1.Text = Calendar1.SelectedDate
Calendar1.SelectedDate = Nothing
End Sub
Mar 21 '07 #21
That worked, thanks.

FWIW I am merely replying to the existing messages in the thread. What else
do you want someone to do?

"Mark Rae" wrote:
>
"NH" <NH@discussions.microsoft.comwrote in message
news:BF**********************************@microsof t.com...
Thats not correct, I was replying to your earlier post. You had replied to
somebody else i.e. David.

FWIW, you're still top posting...
Which event have you put the Calendar1.SelectedDate = Nothing into ?

The one you mentioned:

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Calendar1.SelectionChanged
TextBox1.Text = Calendar1.SelectedDate
Calendar1.SelectedDate = Nothing
End Sub
Mar 21 '07 #22
"NH" <NH@discussions.microsoft.comwrote in message
news:7B**********************************@microsof t.com...
That worked, thanks.
Hurrah!
FWIW I am merely replying to the existing messages in the thread. What
else
do you want someone to do?
You are placing the text of your reply *above* the text that you are
replying to... this is called top posting...
http://linux.sgms-centre.com/misc/ne...te.php#toppost

There are some groups where top posting will actually get you banned... :-)
Mar 21 '07 #23
Ah now I see what you mean. Thats funny because I dont like it when people
add in there text at the end of the messages. You have to scroll all the way
down just to read one line or something. I guess everyone has their own
preference. And I am top posting again :)

"Mark Rae" wrote:
"NH" <NH@discussions.microsoft.comwrote in message
news:7B**********************************@microsof t.com...
That worked, thanks.

Hurrah!
FWIW I am merely replying to the existing messages in the thread. What
else
do you want someone to do?

You are placing the text of your reply *above* the text that you are
replying to... this is called top posting...
http://linux.sgms-centre.com/misc/ne...te.php#toppost

There are some groups where top posting will actually get you banned... :-)
Mar 21 '07 #24
"NH" <NH@discussions.microsoft.comwrote in message
news:08**********************************@microsof t.com...
Ah now I see what you mean. Thats funny because I dont like it when people
add in there text at the end of the messages. You have to scroll all the
way
down just to read one line or something.
That's almost as bad, though at least that doesn't mess up the natural flow
of the thread...

Anyway, no biggie - you're problem is resolved, which is the main thing...
:-)
Mar 21 '07 #25

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

Similar topics

7
by: Colin Young | last post by:
I have a UserControl that contains a calendar control. The calendar is not raising events (month navigation, date selections, etc.). I've checked that the OnSelectionChanged event has a handler...
0
by: Jimmy | last post by:
I am using Calendar control in my ASP.Net application. When the user clicks a command button, I am making it(calendar control) visible. Once the user selects the date, I am making calendar contol...
2
by: D. Shane Fowlkes | last post by:
http://www.drumpub.com/caltest.aspx Check the test page at the above link. Could someone please tell me why I'm capturing the calendar's SelectedDate "one post behind"? The source code is on...
2
by: mg | last post by:
When I click any date in System.Web.UI.WebControls.Calendar (C# WebForm), the SelectionChanged event handler fires. If I next click on the same date again, this event handler does not fire, so I...
1
by: hazz | last post by:
I have two arraylists that populate two Grid controls. I have two Calendar controls to select a 'From' and 'To' date to filter what is in the grid for subsequent filtered views of the what is...
1
by: MattB | last post by:
Hi. I posted yesterday about being able to get to Day.IsSelecteable from outside the calendar's DayRender event. I never figured that out, so I found another way to do what I needed by...
3
by: Peter | last post by:
I have a page that has multiple calendars on it and sync off of the DayRendered event on each control. My problem is that if a user clicks on one calendar, it causes a refresh and kicks off all the...
1
by: P K | last post by:
I have around 20 calendar controls on my screen besides 20 textboxes. The functionality of each control is the same, they take in a parameter for the textbox name and open a calendar in a popup....
2
by: Mariano Padilla | last post by:
The calendar control only has the event of SelectionChanged to detect if the user clicks on the calendar. I have 2 calendars on a form, one for arrival date one for departure date. Every time a...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.