Advice on displaying and allowing editing of data using ASP.NET MVC?
- by Remnant
I am embarking upon my first ASP.NET MVC project and I would like to get some input on possible ways to display database data and general best practice.
In short, the body of my webpage will show data from my database in a table like format, with each table row showing similar data. For example:
Name Age Position Date Joined
Jon Smith 23 Striker 18th Mar 2005
John Doe 38 Defender 3rd Jan 1988
In terms of functionality, primarily I’d like to give the user the ability to edit the data and, after the edit, commit the edit to the database and refresh the view.The reason I want to refresh the view is because the data is date ordered and I will need to re-sort if the user edits a date field.
My main question is what architecture / tools would be best suited to this fulfil my requirements at a high level?
From the research I have done so far my initial conclusions were:
ADO.NET for data retrieval. This is something I have used before and
feel comfortable with. I like the
look of LINQ to SQL but don’t want
to make the learning curve any
steeper for my first outing into MVC
land just yet.
Partial Views to create a template and then iterate through a
datatable that I have pulled back
from my database model.
jQuery to allow the user to edit data in the table, error check
edited data entries etc.
Also, my intial view was that caching the data would not be a key requirement here. The only field a user will be able to update is the field and, if they do, I will need to commit that data to the database immediately and then refresh the view (as the data is date sorted). Any thoughts on this?
Alternatively, I have seen some jQuery plug-ins that emulate a datagrid and provide associated functionality. My first thoughts are that I do not need all the functionality that comes with these plug-ins (e.g. zebra striping, ability to sort by column using sort glyph in column headers etc .) and I don’t really see any benefit to this over and above the solution I have outlined above. Again, is there reason to reconsider this view?
Finally, when a user edits a date , I will need to refresh the view. In order to do this I had been reading about Html.RenderAction and this seemed like it may be a better option than using Partial Views as I can incorporate application logic into the action method. Am I right to consider Html.RenderAction or have I misunderstood its usage?
Hope this post is clear and not too long. I did consider separate posts for each topic (e.g. Partial View vs. Html.RenderAction, when to use jQury datagrid plug-in) but it feels like these issues are so intertwined that they need to be dealt with in contect of each other.
Thanks