Thursday, April 15, 2010

DateFormatString in Asp.net

Even if you change the dateformatstring to {0:d} or something else, sometimes it won't work exactly we intended. We need the short date but it would appear as long date.
- The workaround could be the following :
-Click on gridview properties( at the top right side)
-Click on "Edit Columns"
-select the date column and click on "convert this field into a template field".
It will send the code to aspx source code.
- Then the date will appear as expected.

I guess the dateformat now will be set at the client side.

Wednesday, April 14, 2010

Databse is set to readonly when created a new copy or attached.

-Add the user "Network Service" in the folder where the mdf and ldf file is stored.
-Right click on the database name which is read only in sql server.
-Click on properties -> Options.
-Goto "State"
- Set the "Database Readonly" to false.
-Click on OK