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

calendar problem

Hi there,
I have a problem with a calendar control. I put the following function in
the SelectionChanged event

public void DatePick(object sender, System.EventArgs e)
{
TxtDate.Text = Calendar1.SelectedDate.ToShortDateString();
Calendar1.Visible = false;
}

I open and close the calendar with this function:

public void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Calendar1.Visible = (Calendar1.Visible == false) ? (true) : (false);
}

The problem is if the user selects the same day which has been previously
selcted the Calendar will not disappear, because the selection has not
changed. How could I make the Calendar disappear when the user selects the
same day? Putting code in the Page.IsPostBack event does not do the trick..

Any sugestions are welcome. Thanks a lot

Chris

Nov 17 '05 #1
5 3035
One way would be to provide a Calendar1_OnClick event override and hook
up the Calendar's Click event to fire this method.

public void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventA*rgs e)
{
if(Calendar1.SelectedDate.ToShort*DateString() ==
DateTime.Today.ToShortDateString())
{
// save date?
}
Calendar1.Visible =
(Calendar1.Visible == false) ? (true) : (false);
}

Nov 17 '05 #2
One way would be to provide a Calendar1_OnClick event override and hook
up the Calendar's Click event to fire this method.

public void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventA*rgs e)
{
if(Calendar1.SelectedDate.ToShort*DateString() ==
DateTime.Today.ToShortDateString())
{
// save date?
}
Calendar1.Visible =
(Calendar1.Visible == false) ? (true) : (false);
}

Nov 17 '05 #3
Unfortunately this does not do the trick. What I menat is that I can not make
the calendar "invisible" when someone clicks on the same day which has been
selected before.

Chris

"twostepted" wrote:
One way would be to provide a Calendar1_OnClick event override and hook
up the Calendar's Click event to fire this method.

public void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventAÂ*rgs e)
{
if(Calendar1.SelectedDate.ToShortÂ*DateString() ==
DateTime.Today.ToShortDateString())
{
// save date?
}
Calendar1.Visible =
(Calendar1.Visible == false) ? (true) : (false);
}

Nov 17 '05 #4
Unfortunately this does not do the trick. What I menat is that I can not make
the calendar "invisible" when someone clicks on the same day which has been
selected before.

Chris

"twostepted" wrote:
One way would be to provide a Calendar1_OnClick event override and hook
up the Calendar's Click event to fire this method.

public void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventAÂ*rgs e)
{
if(Calendar1.SelectedDate.ToShortÂ*DateString() ==
DateTime.Today.ToShortDateString())
{
// save date?
}
Calendar1.Visible =
(Calendar1.Visible == false) ? (true) : (false);
}

Nov 17 '05 #5
Chris,

Sorry, are you sure that you can't use it? Does the calendar not
provide a Click delegate which you can hook an Calendar1_OnClick
delegate to? I had a typo in my last post, should have been

public void Calendar1_OnClick(object sender,
System.Web.UI.ImageClickEventA**rgs e)

rather than

public void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventA**rgs e)

If the calendar provides this method, you can do a
Calendar1.Click += new EventHandler(Calendar1_OnClick);

Are you familiar with this type of code?

Nov 17 '05 #6

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

Similar topics

16
by: DFS | last post by:
If you're listening, I want the middle of the calendar (showing 1 month) to open below the cursor position. It currently opens just to the right and below the cursor position. I hunted through...
5
by: Miguel Dias Moura | last post by:
Hello, i am trying to create a .css file with several styles and apply them to the calendar control so i can change the look of: 1. Text Type and Format (Bold, Underline, etc) 2. Background...
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...
3
by: =?Utf-8?B?UGFycm90?= | last post by:
I applied the following Ajax code in my web page which has a calendar control to keep my page from completely reloading everytime something was changed. <atlas:ScriptManager ID="ScriptManager1"...
24
by: =?Utf-8?B?Tkg=?= | last post by:
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,...
3
by: thorpk | last post by:
I posted this problem earlier in the month and some one decided it was better to change the subject and ask a completely different question. I am therefore reposting. I am hoping some one can...
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.