The blog has moved to ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Wednesday, November 17, 2010

ASP MVC Razor templates with nested layout and sections

Using ASP MVC 3 with Razor views.

Ran into an issue with nested layouts and wanting to render a section in a top level layout, but define it in the view which uses a 'child' layout (master) page. This was generating a runtime error of:

The following sections have been defined but have not been rendered for the layout page... 

I posted some code to the forum and github. A nice workaround was supplied by 'Imran Baloch'

Tuesday, November 16, 2010

Automapper Datatable to List

I did a few Google searches for "c# automapper datatable to list" but nothing good showed up right away, maybe this post will help someone in the future?

The solution showed up on stackoverflow here is the link

and here is a code snippet

Note that we are actually mapping IDataReader to a list, and DataTable has convenience method to do that for us 'CreateDataReader'

Friday, November 5, 2010

Get the date of the beginning and end of a month using Ruby

Sometimes Ruby blows my mind, I needed to get the start date and end date of the previous month. Guess what Ruby just happens to have methods to handle this - beginning_of_month, end_of_month, there is even beginning_of_quarter and end_of_quarter if you need them!