Editing Tables with ASP.Net - Quick 'n Dirty

I need to give users the ability to edit tables in ASP.Net. Tables are simple (there is no relationship between masters / parts), but there are likely to be many. What is the fastest / easiest way to provide a view / edit interface for a table, even considering the commercial possibilities (but not Iron Speed ​​Designer. This thing is ridiculously expensive for what I need)?

In the simplest / ideal configuration, I would like to point the control to a table and do it. I looked at several ORM solutions, but they all try to become a Swiss army knife, which simply runs into complexity and, as a rule, is a beast for itself.

Is there anything crazy that can help me here? Or should I just dive into SubSonic or something similar?

+6
orm crud dynamic-data subsonic
source share
4 answers

After some research, the fastest thing I found turns out to be just using linq for sql with a GridView. I was looking for a solution that can easily integrate into existing pages. Without the benefits of auto-scaffolding and generated pages, Dynamic Data kinda skips the mark. 99% of what I wanted was to avoid entering SQL statements and manually processing UpdateCommands commands.

Here are the steps I wrote for my personal link. It depends heavily on designers, but for what I need it, it's perfect:

  • New project (or existing project)
  • Add LinqToSqlClass file to project
  • Add relevant tables from a data source for surface design (use server explorer)
  • Build a project (so that the datacontext class is generated)
  • Go to aspx page
  • Drag the linqdatasource object from the toolbar.
  • Configure the data source (be sure to enable the update if necessary)
  • Drag the grid from the toolbar
  • Set data source for created linqdatasource object
  • Customize columns if necessary (i.e. set the readonly property to immutable columns, hide inappropriate columns.)

Regarding dynamic data, documentation is currently lacking. There are many things that reference earlier versions that are currently not working. I watched the video here and followed the steps here , but ended up having problems when I tried to hide non-editable columns. The update statement created by linq did not refer to the primary key, and I got a string not found or modified . I gave up and used the solution above.

Hope this helps someone else in the future!

+5
source share

Dynamic data is a very easy way to edit database tables through ASP.Net. I did not know about this, but I created a site to edit a small database in just 5 minutes using one of Scott Guthrie's blog post . It handled the simple foreign key relationships I had.

+5
source share

Try DynamicData with microsoft, built into asp.net 4, available for download for earlier versions.

+4
source share

All Articles