My next problem was that I didn’t find the finished "bikes", so I decided to do something like a universal table editor in the database myself. There are, respectively, tables. They added a general, for editing. Introduced into it: the names of directories, lines select, insert, update, and Delte. Also included: the name of the tables in the database, the name of the identifying column of each table. I considered that I would need this data in the future. At the moment, I could only make the output of these tables with the following code:

protected void lb_catalogs_SelectedIndexChanged(object sender, EventArgs e) { string cmdsel = dv_editcatalog.Rows[2].Cells[1].Text; string cmdupd = dv_editcatalog.Rows[3].Cells[1].Text; string cmdins = dv_editcatalog.Rows[4].Cells[1].Text; string cmddel = dv_editcatalog.Rows[5].Cells[1].Text; SqlConnection sqlcon = new SqlConnection(conn); SqlCommand cmd_SQL = new SqlCommand(cmdsel, sqlcon); SqlDataAdapter da = new SqlDataAdapter(cmdsel, sqlcon); da.SelectCommand.CommandText = cmdsel; //da.UpdateCommand.CommandText = cmdupd; //da.InsertCommand.CommandText = cmdins; //da.DeleteCommand.CommandText = cmddel; DataSet ds = new DataSet(); da.Fill(ds, "TableAny"); GridView1.DataSource = ds.Tables["TableAny"]; this.DataBind(); } 

On the page created hidden detailsview , to get all the data about the selected directory. At first there was a program request to the database, but it was cumbersome, so I decided to simplify it for now. Data is loaded into the grid, buttons sel, upd, del are generated. Of these, only sel works. Help implement your plans. I don't know how to tie the remaining commands to the gridview. In addition to the select command, nothing else is assigned to writes:

"The object reference does not indicate an object instance."

Maybe you chose the wrong direction? Maybe it's better to manage the code with a datasource? I would be grateful for any help.

  • Tried to look for event handlers in the GridView properties? There, in theory, should be to update and delete ... - DmitryBLR
  • Found a solution, though at the expense of the development environment, there GridView takes everything from Datasuorce, which in turn is controlled by AJAX. Now I’ll give below the links for everything turned out nicely and quickly, I’m sorry I don’t have time to develop it myself. Maybe when in the future. - Mr_Lambert_13

2 answers 2

Try using XAF (eXpress Application Framework), Embarcadero or RP Studio.

    In VS, you can create a dynamic data entity website that makes it easy for me to implement the implementation. The only thing that needs to be further understood is with queries to set the normal column names. Here is a look:

    Table of Contents: Using the Dynamic Data Platform

    Directly creating itself: Creating a new web site

    It remains now to fine-tune the web site for my project and design and get into the logs.

    • Bliiiin, the entity website is ASP.NET MVC ... And I have a regular web application. What to do ... - Mr_Lambert_13