Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: my hair is getting thin


Message #1 by "Dan McKinnon" <mddonna@q...> on Wed, 17 Apr 2002 21:00:23
Hi -

With regular ASP I had a page leading to a calendar page in which I 
passed the current date as a querystring. It was as simple as putting 
this wherever I had the right href:

<a href="<%=date%>">blah</a>

Now that I am 'upgrading' to .NET, I cannot get this to work without also 
passing the time with the date. Supposedly, DateValue is supposed to cut 
out that part of the date, and I even have a Wrox book in which it does 
this! But my querystring always looks like this no matter what I try:

http://www.hopecommunity.net/calendar.aspx?date=4/17/2002%2012:00:00%20AM

What I want is just:

http://www.hopecommunity.net/calendar.aspx?date=4/17/2002

Here is my code:
Dim myDate As Date = DateValue(now())
Dim nextDate as Date = DateValue(DateAdd("m", 1, myDate))
Dim lastDate as Date = DateValue(DateAdd("m", -1, myDate))

And then later in the page I have <a href="<%=myDate%>">This month</a> 
like before.

I suppose I could manipulate the string (cut out the time) on the 
receiving page and then reconvert it to a date with date.parse, but this 
is frustrating me.

Also, when you use an href like <a href="<%=myDate%>">This month</a>, 
does that have to be within a form? I know it will pass the querystring 
info whether or not it's in a form.

Any help appreciated.

Dan
Message #2 by "Minh T. Nguyen" <nguyentriminh@y...> on Wed, 17 Apr 2002 13:11:10 -0700
Dan,

	The DateTime has your desired functions built in:

	<a href="calendar.aspx?date=<%=DateTime.Now.Date%>">Click
here</a>

	And no, that doesn't have to be in a form, you can take it out
and save some view state. :)

Minh.

-----Original Message-----
From: Dan McKinnon [mailto:mddonna@q...] 
Sent: Wednesday, April 17, 2002 9:00 PM
To: aspx_beginners
Subject: [aspx_beginners] my hair is getting thin


Hi -

With regular ASP I had a page leading to a calendar page in which I 
passed the current date as a querystring. It was as simple as putting 
this wherever I had the right href:

<a href="<%=date%>">blah</a>

Now that I am 'upgrading' to .NET, I cannot get this to work without
also 
passing the time with the date. Supposedly, DateValue is supposed to cut

out that part of the date, and I even have a Wrox book in which it does 
this! But my querystring always looks like this no matter what I try:

http://www.hopecommunity.net/calendar.aspx?date=4/17/2002%2012:00:00%20A
M

What I want is just:

http://www.hopecommunity.net/calendar.aspx?date=4/17/2002

Here is my code:
Dim myDate As Date = DateValue(now())
Dim nextDate as Date = DateValue(DateAdd("m", 1, myDate))
Dim lastDate as Date = DateValue(DateAdd("m", -1, myDate))

And then later in the page I have <a href="<%=myDate%>">This month</a> 
like before.

I suppose I could manipulate the string (cut out the time) on the 
receiving page and then reconvert it to a date with date.parse, but this

is frustrating me.

Also, when you use an href like <a href="<%=myDate%>">This month</a>, 
does that have to be within a form? I know it will pass the querystring 
info whether or not it's in a form.

Any help appreciated.

Dan

Message #3 by "Steven A Smith" <ssmith@a...> on Wed, 17 Apr 2002 16:17:57 -0400
Try <%=myDate.ToShortDateString %>

Steve

----- Original Message -----
From: "Dan McKinnon" <mddonna@q...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Wednesday, April 17, 2002 9:00 PM
Subject: [aspx_beginners] my hair is getting thin


> Hi -
>
> With regular ASP I had a page leading to a calendar page in which I
> passed the current date as a querystring. It was as simple as putting
> this wherever I had the right href:
>
> <a href="<%=date%>">blah</a>
>
> Now that I am 'upgrading' to .NET, I cannot get this to work without also
> passing the time with the date. Supposedly, DateValue is supposed to cut
> out that part of the date, and I even have a Wrox book in which it does
> this! But my querystring always looks like this no matter what I try:
>
> http://www.hopecommunity.net/calendar.aspx?date=4/17/2002%2012:00:00%20AM
>
> What I want is just:
>
> http://www.hopecommunity.net/calendar.aspx?date=4/17/2002
>
> Here is my code:
> Dim myDate As Date = DateValue(now())
> Dim nextDate as Date = DateValue(DateAdd("m", 1, myDate))
> Dim lastDate as Date = DateValue(DateAdd("m", -1, myDate))
>
> And then later in the page I have <a href="<%=myDate%>">This month</a>
> like before.
>
> I suppose I could manipulate the string (cut out the time) on the
> receiving page and then reconvert it to a date with date.parse, but this
> is frustrating me.
>
> Also, when you use an href like <a href="<%=myDate%>">This month</a>,
> does that have to be within a form? I know it will pass the querystring
> info whether or not it's in a form.
>
> Any help appreciated.
>
> Dan
>

Message #4 by "Dan McKinnon" <mddonna@q...> on Thu, 18 Apr 2002 01:07:40
Thank you so much Minh and Steve -

I got this working finally with your help.

Actually, Minh, <a href="cal.aspx?date?=<%=DateTime.Now.Date%>"> 
ended up sending the time also just like DateValue.

But DateTime.Now.Date.ToShortDateString worked OK.

Minh, I often see your helpful answers on this forum. The company you 
work for is lucky to have you. You are a gentle-spirited guru.

Steve, thanks for ToShortDateString. I looked around in the documentation 
and just didn't see it mentioned. Where can I find this listed?

Long live Wrox forums and ToShortDateString!

Dan




Message #5 by "Steven A Smith" <ssmith@a...> on Wed, 17 Apr 2002 21:06:35 -0400
Well, if you use VS.NET, you just start hitting "." and looking at the stuff
that pops up in Intellisense.  Barring that, download Lutz Roeder's
reflector tool from www.aisto.net/roeder and do a search for "date" (or
whatever class you happen to be having problems with), and it will show you
all of its methods and properties.  Works on third-party stuff, too, not
just the framework.

Steve

----- Original Message -----
From: "Dan McKinnon" <mddonna@q...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Thursday, April 18, 2002 1:07 AM
Subject: [aspx_beginners] Re: my hair is getting thin


> Thank you so much Minh and Steve -
>
> I got this working finally with your help.
>
> Actually, Minh, <a href="cal.aspx?date?=<%=DateTime.Now.Date%>">
> ended up sending the time also just like DateValue.
>
> But DateTime.Now.Date.ToShortDateString worked OK.
>
> Minh, I often see your helpful answers on this forum. The company you
> work for is lucky to have you. You are a gentle-spirited guru.
>
> Steve, thanks for ToShortDateString. I looked around in the documentation
> and just didn't see it mentioned. Where can I find this listed?
>
> Long live Wrox forums and ToShortDateString!
>
> Dan
>
>
>
>
>

Message #6 by "JAMES DONAHUE" <JDONAHUE@F...> on Thu, 18 Apr 2002 08:17:14 -0600
Hi Steve.  Please double check your url....www.aisto.net/roeder doesn't
work for me.  Thanks a bunch!!

>>> ssmith@a... 04/17 7:06 PM >>>
Well, if you use VS.NET, you just start hitting "." and looking at the
stuff
that pops up in Intellisense.  Barring that, download Lutz Roeder's
reflector tool from www.aisto.net/roeder and do a search for "date"
(or
whatever class you happen to be having problems with), and it will show
you
all of its methods and properties.  Works on third-party stuff, too,
not
just the framework.

Steve

----- Original Message -----
From: "Dan McKinnon" <mddonna@q...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Thursday, April 18, 2002 1:07 AM
Subject: [aspx_beginners] Re: my hair is getting thin


> Thank you so much Minh and Steve -
>
> I got this working finally with your help.
>
> Actually, Minh, <a href="cal.aspx?date?=<%=DateTime.Now.Date%>">
> ended up sending the time also just like DateValue.
>
> But DateTime.Now.Date.ToShortDateString worked OK.
>
> Minh, I often see your helpful answers on this forum. The company
you
> work for is lucky to have you. You are a gentle-spirited guru.
>
> Steve, thanks for ToShortDateString. I looked around in the
documentation
> and just didn't see it mentioned. Where can I find this listed?
>
> Long live Wrox forums and ToShortDateString!
>
> Dan
>
>
>
>
>


Message #7 by "h. branyan" <hb@t...> on Thu, 18 Apr 2002 10:33:05 -0400
>>> ssmith@a... 04/17 7:06 PM >>>
> Well, if you use VS.NET, you just start hitting "." and looking at the
> stuff
> that pops up in Intellisense.  Barring that, download Lutz Roeder's
> reflector tool from www.aisto.net/roeder and do a search for "date"
> (or
> whatever class you happen to be having problems with), and it will show
> you
> all of its methods and properties.  Works on third-party stuff, too,
> not
> just the framework.

I think you may also find this information on the framework by going to
Start... Run... and typing in "WinCV"

_h
--
http://thermalnoise.net
AIM: thermalnoise

Style is a fraud. - Willem de Kooning


Message #8 by "Steven A Smith" <ssmith@a...> on Thu, 18 Apr 2002 10:45:03 -0400
Sorry about the bad url - was going from memory.  Here's the reflector tool,
which IMHO is much better than any of the class browsers included in the
framework:

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

Steve


Steven Smith, MCSE+Internet, Microsoft MVP: ASP.NET
ssmith@a...
President, ASPAlliance.com
http://aspalliance.com    The #1 ASP.NET Community
http://aspsmith.com        ASP.NET Training for ASP Developers

Learning ASP.NET?  Get My Book: ASP.NET By Example
http://www.amazon.com/exec/obidos/ASIN/0789725622/stevenatorasp/
----- Original Message -----
From: "h. branyan" <hb@t...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Thursday, April 18, 2002 10:33 AM
Subject: [aspx_beginners] Re: my hair is getting thin


> >>> ssmith@a... 04/17 7:06 PM >>>
> > Well, if you use VS.NET, you just start hitting "." and looking at the
> > stuff
> > that pops up in Intellisense.  Barring that, download Lutz Roeder's
> > reflector tool from www.aisto.net/roeder and do a search for "date"
> > (or
> > whatever class you happen to be having problems with), and it will show
> > you
> > all of its methods and properties.  Works on third-party stuff, too,
> > not
> > just the framework.
>
> I think you may also find this information on the framework by going to
> Start... Run... and typing in "WinCV"
>
> _h
> --
> http://thermalnoise.net
> AIM: thermalnoise
>
> Style is a fraud. - Willem de Kooning
>
>
>
>


  Return to Index