473,324 Members | 2,567 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,324 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 3032
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: 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...
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
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...
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.