Reputation: 17196
This works as fine in my ASP.NET page's SqlDataSource:
<asp:SessionParameter Name="FromTimestamp" SessionField="fromtime" DefaultValue="2/22/2012" />
Why does this produces error: Conversion failed when converting date and/or time from character string.
<asp:SessionParameter Name="FromTimestamp" SessionField="fromtime" DefaultValue='<%=DateTime.Now.ToShortDateString()%>' />
Upvotes: 1
Views: 273
Reputation: 4412
DateTime.Now.ToString("M/d/yyyy")
Will get you the format you already know works.
Upvotes: 2