November 27th, 2007


ASP.NET dateformat in a gridview (the DataFormatString={0:M-dd-yyyy} Problem)

Glad to find out I'm not doing this wrong - if you simply apply a dateformat to a bound field in a gridview, you won't get the result you expect. Easy way to fix? Set "HtmlEncode" to false. The more complex solution is to make it a template column and set the value programmatically.

I got the information from this blog entry - How To Set a Date Format In GridView Using ASP.NET 2.0

ASP.NET SQLDataSource tip

Note to self: Remember to set "CancelSelectOnNullParameter" to false if your stored procedure can accept null values or blank strings. Otherwise, you will spend time hunting around to find out why certain queries work and others don't.