problem with date conversion

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Hi,

i want to pass the date/time from one page to another page like this:

firts page:
---------
<asp:HyperLink ID="HyperLink1" NavigateUrl="mypage.aspx?dat= & 'date.now'"
runat="server">lijst</asp:HyperLink>

the code-behind of mypage.aspx
---------------------------------
Dim dd As Date
dd = Date.Parse(Request.QueryString("dat"))

this gives the error: String was not recognized as a valid DateTime

Thanks for help
Bob
 
Bob said:
i want to pass the date/time from one page to another page like this:

firts page:

I am not familiar with ASP.NET, but I wonder if the value of the
'NavigateUrl' attribute really contains the date using the syntax used
above. In addition, make sure you use 'CultureInfo.InvariantCulture' in
'Now.ToString(...)' to use a culture-invariant date format.
 
Bob said:
i want to pass the date/time from one page to another page like this:

firts page:
---------
<asp:HyperLink ID="HyperLink1" NavigateUrl="mypage.aspx?dat= &
'date.now'" runat="server">lijst</asp:HyperLink>

the code-behind of mypage.aspx
---------------------------------
Dim dd As Date
dd = Date.Parse(Request.QueryString("dat"))

this gives the error: String was not recognized as a valid DateTime

I suspect your date is getting slashes in it, which in a URL may mess things
up. Try DateTime.Now.ToString("yyyyMMddTHHmmss").

Andrew
 
Bob said:
Hi,

i want to pass the date/time from one page to another page like this:

firts page:
---------
<asp:HyperLink ID="HyperLink1" NavigateUrl="mypage.aspx?dat= & 'date.now'"
runat="server">lijst</asp:HyperLink>

the code-behind of mypage.aspx
---------------------------------
Dim dd As Date
dd = Date.Parse(Request.QueryString("dat"))

this gives the error: String was not recognized as a valid DateTime

Thanks for help
Bob

Why dont you try using a session variable. It lives with the user's session.
 
Back
Top