jqGrid vs. Html.Grid Helper - asp.net-mvc-2

I have been using jqGrid as my grid view to my data for some time now. It works well and it was easy to implement into my solution. However, due to some refactoring going on within the project right now, I have been looking into it again.
The project itself is built around ASP.NET MVC 2 (.NET 4.0). We need some extra functionality such as:
Being able to add columns.
Inline editing of columns.
Sorting
Filter
Paging
Searching
jqGrid does all of this (although, not all of this functionality is implemented yet - some of it is new based on new needs). But, given that I am using ASP.NET MVC, I was wondering if it would make more sense to switch to the Html.Grid helper. It looks just as easy to implement for the things I know it can do (Sorting/Filtering/Paging), but I do not know if it can even do the other tasks (in a fairly straightforward manner) - anything I have found seems somewhat "hackish."
Can anybody enlighten me on A.) the capabilities of Html.Grid to jqGrid and B.) if there is any reason I'd want to take Html.Grid.

I use jqGrid successfully with ASP.NET MVC 2 (.NET 4.0) and have all the features which you describe in your question. Moreover all pages having jqGrid looks like very simple.
I don't use Html.Grid or any MVC controls. I include just pure HTML fragment <table id="list"></table><div id="pager"></div> on the page. Additionally I include the JavaScript which initialize the "list" table and the "pager" div as the jqGrid. So the implementation is independent from MVC concept. The most important part of the jqGrid integrations is the actions which get back pure JSON output and which implement GET/PUT/POST/DELETE operations with the jqGrid. You can read more about the approach here (see also many links with code examples included in the answer).
To be exactly I prefer to use WCF as a part on my ASP.NET MVC solution and the WCF methods provide the data needed for jqGrid (see here more details), but you can implement all as pure ASP.NET MVC actions.
If you use Unit testes for you ASP.NET MVC site you can successfully write tests for WFC methods or controller actions used by jqGrid. In the way you will test the most parts of jqGrid implementation.

After looking at both approach, I decided the jqGrid was a far easier (and simpler) approach for what I was attempting to do.

Related

what's the difference between ASP.NET controls and Html.helpers in ASP.NET MVC?

I'm completely new to C#, asp.net and asp.net mvc. I'm just starting and trying.
so here is my question: what's the difference between ASP.NET MVC Html.helpers and ASP.NET Controls? I know they both can be used to create forms in a page, but what's the difference? I mean, I can use ASP.NET Controls in my MVC project, so what's the point of using Html.helpers? It would be great if somebody explains the difference about Html tags too.
So,when I should use ASP.NET Controlls, when I should use ASP.NET MVC, and when I should use Html Tags?
by the way, I'm using ASP.NET MVC2 in Visual Web Developer 2008 Express.
sorry for my bad English thingy!
Big difference, basically an HTML Helper translates to HTML on the Server when it pushes back to the client.
Controls are not available in MVC (you are thinking web forms), but that's a personal preference whether you like this or not. The forms make it easy to create complicated HTML structures, but there's a lot of "Magic" in how they render, MVC gives you complete control.
Once you start using MVC more you will appreciate the flexibility and not miss controls one bit. Plus, a lot of Open Source stuff out there to give you powerful "Helpers"
To add to Mark's answer: Although both ASP.NET controls and HtmlHelpers emit HTML, that's where the similarities end.
ASP.NET controls are very heavy. Many of them maintain their own state across postbacks to give the illusion that you are programming a stateful Windows Forms application. These controls have strange and mangled ID's, add many bytes to your "viewstate" hidden form field, and often have difficult to control markup and CSS styling.
HtmlHelpers render HTML in a customizable way that is lightweight because you control the HTML that is emitted, ideally WITHOUT any state information littering your markup. You control the ID's, the styles, everything. But you lose the automatic state management that the controls give you.

Looking for a technique to reduce "controller repetition" for CRUD operation in ASP.NET MVC

I am developing the administration part of a site. It mostly consist of manipulating list of data such as:
Products
Suppliers
Tax profiles
...
I find the task of creating a controller that handle the CRUD operations of each model a little too repeating and prone to mistake from one controller to another.
I would still need to adapt some of these controller for additional operation, but not all.
Does someone know a proven approach for reducing the implication of controller for the usual CRUD operations?
One suggestion would be to look at tweaking the T4 template that is used to generate the scaffold methods. Check out Rob Conery's MVC Starter Site to see what he's done (look in /Web/CodeTemplates in the source for the general idea).
There are also some other MVC libraries out there such as FubuMVC that aim to cut down on code repetition, but it's not based on the actual ASP.NET MVC framework (and it's not really my thing).

Need advice on removing zend framework dependency

I'm in the middle of converting an existing app built on top of zend framework to work as a plugin within wordpress as opposed to the standalone application it currently is.
I've never really used zend so I've had to learn about it in order to know where to begin. I must say that at first I didn't think much of zend, but it's funny because the more I understand how it works the more I keep questioning why I'd want to remove dependency when it's a clearly well thought out framework. Then I'm reminded that it's because of wordpress.
Now I already know there are WP plugins to make zend play nice with WP. In fact I'm aleady using a zend framework plugin just to get the app functional within the WP admin area which is allowing me to review code, modify code, refresh the browser, review changes, debug code, again and again.
Anyway, I really don't have a specific question but instead I'm looking for advice from any zend masters out there to offer advice on how to best go about a task like this one.... so any comments, advice, examples or suggestions would be super.
One area I'm a little stuck on is converting parts of zend->db calls to work as wpdb calls instead... specifically the zend->db->select.... not sure what to do with that one.
Also on how to handle all the URL routing with automatic calls to "whatverAction" within thier respective controllers files.
Any help would be great! Thanks
You're probably facing an uphill battle trying to get some of the more major components of ZF to work in harmony with Wordpress. It sounds like you've got a full MVC app that you're trying to integrate into a second app that has very different architecture.
You probably want to think about which components handle which responsibilities. Wordpress has it's own routing and controller system that revolves around posts, pages and 'The Loop'. This is entirely different from Zend's Action Controllers and routing system.
It's possible you could write a WP hook to evaluate every incoming request and decide if it should be handled by WP or a ZF controller. However, it is doubtful you would be able to replace WP's routing system outright with ZF's or vice versa.
Same idea, where Zend_Db is concerned. There's nothing stopping you from using Zend_Db to access Wordpress's database, but trying to somehow convert or adapt Zend_db calls into wpdb calls sounds painful. If you have a large model layer, you probably want to hang on to it, and find a way to translate data from those models into the posts/pages conventions that Wordpress uses.
Personally, I would use ZF to build a robust business layer that can be queried through an object model via a Wordpress plugin, and then rely on Wordpress to do the routing and handle the views.
Zend_DB_Select is simple SQL query (but created using objects) that can be used like any other query. Just turn it into string. Ex.:
mysql_query((string)$zendDbSelectObject);

What's the best way to paginate a dataset with Zend_Framework and Doctrine?

Before I start to build this myself I thought I'd ask others to share their experience. What's the best / your favorite way to paginate a dataset with an application built upon Zend_Framework and Doctrine as your ORM?
I'm new to Doctrine.
I'm calling the model directly from a View Helper, bypassing the Controller, although I'm still interested if your solution uses controllers.
I did see one article on this topic:
http://ciaranmcnulty.com/blog/2009/06/Simplify-pagination-logic-using-a-custom-zend-paginator-adapter
Devzone has an article using Doctrine, Zend Framework OR Pear, but none of those options mention a #ZF app that uses Doctrine.
You don't need anything special.
Look on Github for ready paginator adapter, e.g. this one.
In theory, one way is to create a custom data source adapter and plug it into Zend Paginator. http://framework.zend.com/manual/en/zend.paginator.advanced.html

Web Framework that handles forms intuitively?

Will be starting a web app that will have to provide many different HTML forms for data entry, so I was wondering if there is a web framework out there that does this in a clever way. generally when you have forms you have many considerations like navigation, validation, etc. that are not handled very efficiently by he frameworks I've seen so far.
Has someone taken the pain out of forms?
Have you tried looking at Grails? It can take your domain classes and dynamically scaffold them into web forms and apply server-side validation. The default scaffolding provides navigation, pagination, validation, and all kinds of other -ations that are pretty good!
Here's a good tutorial.
Try Qcodo.com, It is written in PHP (but fully OOP). It manages both database layer with nice Form templating system.
I think forms are handled pretty cleverly in Ruby on Rails. And also in .Net. The latter goes pretty far in letting you reuse the database logic for validating data and also has "automatic" handling of security issues like XSS and XSRF.