Adding rows to the MVCContrib Grid - asp.net-mvc

I'm developing my first MVC website and I'm experimenting with the few available grids out there. I really like the MVCContrib grid, but I need to implement a standard "Add new record" functionality, and I don't see a clear way to add a single record to the database and grid without having to reload the entire grid each time.
I know there is a jQuery grid plugin, and if there's no good way to do this with MVCContrib I'll go that direction.

After much looking around it would seem that my best solution is a framework like jQuery or ExtJS. MVCContrib Grid isn't there yet, if it ever will be.

Related

How to generate UI at runtime in asp.net mvc

i am new in mvc. i want to generate a UI dynamically like
initially a table will be displayed with four columns and 5 rows. in first & second columns there will be dropdown with predefine values and in last column there will be textbox. there will be a button called add more and when user will click on that button then a postback will occur and a new row will be added to that existing column. user can remove any column just clicking on another button which will be in fourth column.
it is very easy to do it in webform with gridview but i have no idea how can i do it in mvc. i do not want to use any js library or grid rather i want to do it with html table which i will generate dynamically. please help me with concept & sample code snippet if possible. thanks
I cant see here something really connected with mvc.
The case is that you would like to have an interactive UI, that basically is the job of Javascript.
If we are talking about grids, it can be next plugins/frameworks:
Kendo UI (not free for commercial use) - http://demos.kendoui.com/web/grid/editing.html
http://jquerygrid.net/
A lot of good plugings are here: Choosing a jQuery datagrid plugin?
So basically this is the same (like) Grid View from asp.net.
If you wanna have something exactly like GridView - I think there is no native implementation (from Visual Studio) for this (maybe i'm wrong, but 4 year experience say to me that i'm right :) ).

What would be a good way to implement a grid in MVC3?

I am wanting to edit a number of rows in a model in a grid. I would really like to be able to edit "inline" ie within the grid rather than going off to another page via another controller.
I know about the "Web Grid" which seems lean, but I believe it needs to go over to an edit page.
In the first instance I am wanting to focus on server solutions for simplicity. Also I would want the control to respect the validation data annotations in the View Model.
Many thanks,
Ed
You can render your own grid for a table of data and include a form within it to allow the user to edit a particular row. You will need to implement typical grid features to control this process, such as row selection, insert, edit, update and possibly delete. There are plenty of good models from Web Forms world you could work to, including but not limited to MS and Telerik controls.
If you are going to make extensive use of such grids in your applications I would recommend wrapping up this functionality in an HtmlHelper extension that accepts a table of data and the configuration options you need as arguments.
http://datatables.net/ is a very good jQuery grid. Try it out.
also other options
kendo: http://demos.kendoui.com/web/grid/index.html
jqgrid. http://jqgrid.com/

Which datagrid to use for ASP.NET MVC2 project?

I am developing a commercial MVC2 app that requires a grid that has callback update in some form to support 10,000+ rows. It should also support relatively rich content (icons, multiline descriptions etc). Although it requires the usual paging/scrolling/sorting features it does not need support for grouping. So nothing that special.
The commercial grids I looked at were Component Art and Telerik which both look pretty good but may be a little OTT for what I need. They are also $800 and $999 respectively (1 developer).
I've also looked at jqGrid and the grid from MvcContrib. These appear ok but for a commercial app I am concerned that these may be risky options - though could be wrong there.
I'd really appreciate any views/exprience on either the above grids or perhaps you can suggest a better option/approach.
FYI I am using EF4 and C#.
I have quite a bit of experience with jqGrid, the grids from DevExpress and telerik, as well as ExtJS. By far, my favorite of the bunch is jqGrid. I'm not concerned with lack of support or the project going away. They had just recently introduced a redesigned grid for use with MVC: http://www.trirand.com/blog/?p=639
telerik and DevExpress are both excellent in their own way. A friend of mine has had issues with the eventing model of the telerik grid, and I've experienced quite a bit of 'html bloat' from the DevExpress grid. telerik has great support for doing things like reordering columns on the client side, while the DevExpress grid requires a call back to do this.
ExtJS is wonderful, but I really feel that it is a very heavy JavaScript grid. Performance in IE can be dreadful with the ExtJS grid. It generally performs well if you do not have a lot of columns, or do not try and put more than one grid on a page. You'll want to definitely avoid putting the ExtJS grids into Tab controls, as all sorts of issues arise when the grid is rendered to a non visible element.
We've actually just recently decided to switch all of the grids used in our reporting system over to telerik's Silverlight grids, which perform beautifully compared to their JavaScript counterparts.
Hope this helps, and good luck.
Honestly, you can develop your own with MVC rather easily giving you all that you need. Though I suppose if you need something quick that works, the MvcContrib grid is great.
give a look to the datagrid of the MVC Controls Toolkit. It appears quite flexible. It allows editing, deletions, insertions and paging. Moreover it is really easy to move the changes to a DB in the controller. Look at it here.
There is a DevExpress grid much the same as Telerik which again might be over the top for you. However you can buy the grid on it's own rather than the whole suite although it may not be worth doing that since the grid is almost half the price of the suite.
My last shot at components for ASP.NET MC was not succesfull. Its so much harder to have a controll for MVC then for old school ASP.NET.
the routing the controll expects has to mapp nicely to the routing of your application
things get much harder when you have more then 1 grid on the page
if the controll has to work for non-Javascript enabled clients your choices are even more limited
if the back button of the browser needs to be working your choice is even more limited
In my case it turned out that it was much better to use plain html and jquery to realise paging, sorting and filtering for a table. I would draw the line if your site is more a public website (like mine) or an application that has a web frontend.
We use the ExtJS grid in out ASP.NET MVC project.
http://www.extjs.com/deploy/dev/examples/grid/array-grid.html
I recently research about this and the winning was jQgrid for performance is the Best!

What's the best way to create a paging gridview-style partial view in Asp.net MVC?

In the current MVC project I'm working on, I need to be able to create something exactly like the GridView from asp.net webforms. I'm actually using FubuMVC, but I can adapt any Asp.net MVC solution to the Fubu framework.
I want to create something that has the same kind of functionality as the GridView. To explain further, I mean I want something to list 10-20 items out of a list of 100-200 items, with sorting and paging.
Currently, I could create something like this straight-up in MVC on a case-by-case basis, depending on what I was trying to list. Implementing sorting and paging as controller actions, or something similar, but it seems like such a common problem that their must be some type of reusable solution. Only problem is that I can't think what the optimal solution to this problem is.
So, what's the best way to create a gridview-style something in Asp.net MVC?
Thanks for reading.
I use jQGrid. It does all that and a bit more.

Large data entry pages using ASP.NET MVC

I am working on a large data entry page using the default ASP.NET MVC theme. Due to the large number of controls on the page it would be good to use a two column fieldset so the user does not need to scroll. I can't see any templates in the MVC design gallery that use a two column data entry page, they are all geared towards standard website designs. Has anyone seen any? It would be great to have templates for different data entry scenarios.
Thanks
Danny
What you can do is create your own T4 (Text Template Transformation Toolkit) file. You can find out more here. This will give you an extra view content option in your "Add View" dialog box, generating the HTML however you've specified.
If your problem is to show all controls on single window without scrolling and may be using two columns,Right!
I have another solution for you.
And that is Wizard. check out this link and this link.
Your form will look nice!
If your issue is layout, you can lay it out in the design view first (or dreamweaver or the designer of your choice) then add the MVC specific code.

Resources