I have a gridview that shows records from a database table. Now, I want to edit records, as well as add some. I’ve seen that DetailsView is widely used for that purpose. However, it’s seems to me that is kind of limited, when talking about design (CSS).
So I ask: what is the best way to add/edit a record? Using this control, or create from scratch a nice fancy form (using jquery, for example)?
You can use this control. There are several methods you can go about using it too. One of the ways, that I usually do (probably a less complex method), is to bind the result set from your query to the gridview, and also have an edit button column where each button corresponds to the same action event in the code-behind. When the user hits the edit button for a given row, you can pull the data from that row and populate input controls on the page, or a different page to be edited by the user (keep track of the record ID they’re editing). When they click an “update” button, the program should take the data in the input controls and update the record that is being edited.
I’m sure there are ways to edit a record in the gridview itself, and I plan on learning how to do so soon :p