Problem solve Get help with specific problems with your technologies, process and projects.

How can I make a datagrid editable without a roundtrip?

Can you tell me how to make a datagrid editable? The catch is that I don't want to use the built-in functionality because it makes a roundtrip to the server and replaces a grid row with textbox. I want to do this without a roundtrip. Is this possible? I have seen some third-party controls achieve this functionality. Your help is highly appreciated. Thanks.
This is complicated scenario. It would be easy to make a row editable through JavaScript and a little DOM manipulation. You could locate the row to edit and replace the text nodes in it with new textboxes pre-filled with the existing data. However, the real problem is how you can tell the server-side (which is the one that will persist the changes) that something has changed. If you do all client-side, then you will need to apply changes for all rows, just in case. Or you could have a hidden column signaling changed rows, etc. What you need to realize is that building a powerful and flexible grid is not trivial. It can't even be explained in a couple dozen pages. That's why companies dedicate to build (and sell) them. My advice is: unless you're only looking to learn OO JavaSript and ASP.NET control development in depth (including templating, databinding, etc.), and are willing to spend maybe more than a couple months to achieve it, you'll better off buying a third-party grid. It will save you (and your company) time and money, and you'll get support too. If you want to build custom controls, go for more specific controls that your concrete application needs, such as a CustomerViewerControl, or a CustomerQueryControl, or whatever, and leverage the grid (or any other generic third-party control) inside it.

Dig Deeper on Win Development Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.