Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Get the same selected date from the calendar two consecutive times

Reply
Thread Tools

Get the same selected date from the calendar two consecutive times

 
 
mg
Guest
Posts: n/a
 
      06-01-2004

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 can't get the selected date directly from the calendar on two successive attempts.

How can I get this same selected date from the calendar on two successive attempts. Storing the value obtained on the first attempt isn't helpful
 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      06-02-2004
This might be a hack but it seems to work... call SelectionChanged
yourself....

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
If IsPostBack Then
If viewstate("stopcalendarchange") _
<> True Then
Call Calendar1_SelectionChanged _
(Calendar1, Nothing)
End If
End If
End Sub

Private Sub Calendar1_SelectionChanged _
(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Calendar1.SelectionChanged
Label1.Text = _
Calendar1.SelectedDate.ToLongDateString & _
" at " & Now.ToLongTimeString
End Sub

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
viewstate("stopcalendarchange") = True
Label1.Text = "Stopped getting same date."
' Calendar1.Enabled = False
' Calendar1.Visible = False
End Sub

<form id="Form1" method="post" runat="server">
<asp:Calendar id="Calendar1" runat="server"></asp:Calendar>
<P>
<asp:Label id="Label1" runat="server"></asp:Label></P>
<P>
<asp:Button id="Button1" runat="server" Text="Stop getting same
date"></asp:Button></P>
</form>

Ken
Microsoft MVP [ASP.NET]

"mg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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 can't get the selected date
> directly from the calendar on two successive attempts.
>
> How can I get this same selected date from the calendar on two successive
> attempts. Storing the value obtained on the first attempt isn't helpful


 
Reply With Quote
 
 
 
 
mg
Guest
Posts: n/a
 
      06-02-2004
Thanks

Any chance of getting the C# version of this code?
 
Reply With Quote
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      06-02-2004
Your best bet would be to compile it and then decompile it to C# with
Reflector:

http://www.aisto.com/roeder/dotnet/

Ken


"mg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks!
>
> Any chance of getting the C# version of this code?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the same selected date from the calendar two consecutive times =?Utf-8?B?bWc=?= ASP .Net 2 06-02-2004 10:21 AM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
How to get selected date from a Pop Up Window Calendar? Andreas Klemt ASP .Net 1 01-24-2004 12:58 PM
consecutive printwriters on the same outputstream Andy Fish Java 3 11-20-2003 05:25 PM
How to dismiss Calendar Control when same date is selected Rick Lubanovic ASP .Net Web Controls 0 10-20-2003 04:01 PM



Advertisments