rajeeshcv.com

Sharing my knowledge

Asp.Net MVC - Fluent Html helper for FlexiGrid

There are so many free JQuery Grid plugins out there, in that I liked FlexiGrid just because of it’s look and style. In order to use it in your MVC application you may have to put the Javascript code into your view, which requires the property names of your model in order to generates the Grid columns as well the search options etc… as everybody knows when you deal with hard coded string as the property names in any code, it is error prone.

In order to avoid this problem I thought of creating a html extension which is tightly coupled with your data that is going to bound to the Grid. Which helps the developer from writing any javascript codes(I know those who hates(not me! :)) writing Javascript code like this extension).

This project has been uploaded to - http://code.google.com/p/mvc-fluent-jquery-plugin-controls/. You could find more details from there.

Comments

Rajeesh
Rajeesh commented
@Sameer Yes, you figured it out correctly. In that example it is a list. Please look into the full source code of that example from here http://code.google.com/p/mvc-fluent-jquery-plugin-controls/source/browse/trunk/src/MVCControl.JQuery.Plugins/Demo/Controllers/HomeController.cs
Samer Shami
Samer Shami commented
Hi Rajeesh. I figured it out. It was an IList correct?
Samer Shami
Samer Shami commented
Awesome. Thanks Rajeesh. I have a question about the current code however. On http://www.nowiamin.com/ you have some sample code for the controller. In that code you reference a object called "this.employees..AsQueryable();". Can I ask what "this.employees" is?
Rajeesh
Rajeesh commented
Hi Sameer, I haven't tried the string template view engine before, but I will give a try and see whether I could make the helper a view engine independent. Which I think it is important as latest MVC is distributing few other view engines out of the box. Thanks, Rajeesh
Samer
Samer commented
Hi Rajeesh, I like what I see so far of the asp.net helper. However I have chosen to use StringTemplate (string-template-view-engine-mvc) instead of the default ViewEngine. This has a lot more restrictions on it compared to the default - but I want to ensure strict View separation. This means I am having difficulty integrating your helper into my code. Is there any chance you can create a version that doesn't require a HtmlHelper as a parameter and will just return a string? I greatly appreciate the work you have done!
Carlinda
Carlinda commented

I'm so glad I found my sootuiln online.

Gracelin
Gracelin commented

You make thgins so clear. Thanks for taking the time!

Leave your comments