|
 |
aspx_beginners thread: Change SelectedDate on Calendar with Today
Message #1 by "Rich Lipscomb" <rlipscomb@h...> on Sun, 21 Apr 2002 08:20:01
|
|
On page 507 of Beginning ASP.Net:
<asp:Calendar id="MyCalendar" runat="server"
SelectedDate="2001/07/17"
How can I change this fixed date to "Today" ?
Thanks,
Rich
Message #2 by "Minh T. Nguyen" <nguyentriminh@y...> on Sun, 21 Apr 2002 16:12:52 -0700
|
|
Rich,
I am afraid you have code that in your Page_Load method like
this:
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
CalendarControl.SelectedDate = DateTime.Now;
}
But this sure works fine,
Minh.
-----Original Message-----
From: Rich Lipscomb [mailto:rlipscomb@h...]
Sent: Sunday, April 21, 2002 8:20 AM
To: aspx_beginners
Subject: [aspx_beginners] Change SelectedDate on Calendar with Today
On page 507 of Beginning ASP.Net:
<asp:Calendar id="MyCalendar" runat="server"
SelectedDate="2001/07/17"
How can I change this fixed date to "Today" ?
Thanks,
Rich
Message #3 by "Rich Lipscomb" <rlipscomb@h...> on Mon, 22 Apr 2002 04:00:53
|
|
Minh,
I pasted your code into the mycalendar.aspx file, and I received a
compilation error:
Compiler Error Message: BC30205: End of statement expected.
What else should I try?
Rich
> Rich,
I am afraid you have code that in your Page_Load method like
this:
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
CalendarControl.SelectedDate = DateTime.Now;
}
But this sure works fine,
Minh.
-----Original Message-----
From: Rich Lipscomb [mailto:rlipscomb@h...]
Sent: Sunday, April 21, 2002 8:20 AM
To: aspx_beginners
Subject: [aspx_beginners] Change SelectedDate on Calendar with Today
On page 507 of Beginning ASP.Net:
<asp:Calendar id="MyCalendar" runat="server"
SelectedDate="2001/07/17"
How can I change this fixed date to "Today" ?
Thanks,
Rich
Message #4 by "Rich Lipscomb" <rlipscomb@h...> on Mon, 22 Apr 2002 04:24:13
|
|
Don't laugh, but I didn't recognize the below as C#, so I translated it at:
http://www.aspalliance.com/aldotnet/examples/translate.aspx
and I added two lines to the exisiting Page_Load:
Protected Sub Page_Load(ByVal Sender As System.Object, _
ByVal e As System.EventArgs)
If Not IsPostback Then
ShowDailyEvents()
CalendarControl.SelectedDate = DateTime.Now 'this is added
CalendarControl.VisibleDate = DateTime.Now 'this is added
End If
End Sub
and I get this error:
BC30451: Name 'CalendarControl' is not declared.
I'm a newbie (obviously), so how do I go about this?
Many thanks,
Rich
> Rich,
I am afraid you have code that in your Page_Load method like
this:
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
CalendarControl.SelectedDate = DateTime.Now;
}
But this sure works fine,
Minh.
-----Original Message-----
From: Rich Lipscomb [mailto:rlipscomb@h...]
Sent: Sunday, April 21, 2002 8:20 AM
To: aspx_beginners
Subject: [aspx_beginners] Change SelectedDate on Calendar with Today
On page 507 of Beginning ASP.Net:
<asp:Calendar id="MyCalendar" runat="server"
SelectedDate="2001/07/17"
How can I change this fixed date to "Today" ?
Thanks,
Rich
Message #5 by "Minh T. Nguyen" <nguyentriminh@y...> on Sun, 21 Apr 2002 23:20:33 -0700
|
|
Hi Rich,
Oh, I used CalendarControl because my control was named
"CalendarControl", you have to replace that with the name of your
Calendar control.
Hope it works,
Minh.
-----Original Message-----
From: Rich Lipscomb [mailto:rlipscomb@h...]
Sent: Monday, April 22, 2002 4:24 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Change SelectedDate on Calendar with Today
Don't laugh, but I didn't recognize the below as C#, so I translated it
at:
http://www.aspalliance.com/aldotnet/examples/translate.aspx
and I added two lines to the exisiting Page_Load:
Protected Sub Page_Load(ByVal Sender As System.Object, _
ByVal e As System.EventArgs)
If Not IsPostback Then
ShowDailyEvents()
CalendarControl.SelectedDate = DateTime.Now 'this is added
CalendarControl.VisibleDate = DateTime.Now 'this is added
End If
End Sub
and I get this error:
BC30451: Name 'CalendarControl' is not declared.
I'm a newbie (obviously), so how do I go about this?
Many thanks,
Rich
|
|
 |