Thursday, February 20, 2014

bootstrap extensions for asp.net mvc 4

You are probably thinking that the world is moving ahead with ASP.NET MVC 5.1. So why is this post still "stuck" with asp.net mvc 4? Well, that just happens to be the IDE I am working with. Anyway enough with those kind of limitations.

My professional work has taken me through a joy ride with many frameworks to be used along with asp.net mvc like knockout.js, kendo, bootstrap, etc. Kendo is something that has caught my fancy at the moment. And it has something to do with the following lines of code:

@(Html.Kendo().Grid<ForumBrowser.Models.RssItem>()
    .Name("rssItemGrid")
    .Columns(columns =>
    {
        columns.Bound(m => m.Title);
        columns.Bound(m => m.Author).Width(250);
        columns.Bound(m => m.PublicationDate).Width(250);
    })
    .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("GetItems", "Home")))
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
)


Notice the stuff we write as argument to the Columns method call. Of course there is intellisense support when you write such code in Visual Studio. But the underlying idea is generics - lot of generics!

And then there is bootstrap.

I notice that bootstrap has a lot of components - like a menu, navigation bar, dropdowns, etc. The amount of code you have to write for them is also sort of plethoric. Hence, I thought there must be simpler way to reduce the amount of code you write for them.

Therefore, I started up a github repo for the same purpose. How will this be useful? Well, at least for me, its like toolkit I can carry around with me.

No comments: