Master and Detail Grids

TrinitySolutions used Ask the Experts™
Guess I'm just not searching right, because this doesn't seem to be a big thing.

I'm using VWD 2008, so would prefer instructions on using it instead of code (which I'm still fairly weak on).

I want a grid that will allow me to show limited information about a row.  When clicking on an 'edit' button, I want the remaining data about that same row to show up and be editable.

I've used a Formview, but can't seem to make it link back to my initial data list.  I'm sure it should be receiving a passed variable somewhere.  Analytically, I get it, just can't get it in the pc!

What form/grid would be best to use initially - how should it pass the paramater - to what grid should it be passed to be able to edit it1?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can make a custom form with the layout you want and all the fields you would want to edit.
When the user clicks on the edit button, the actual selected row is used to populate a datatable. This datatable is then used to populate the form with data.
When the user accepts the edited data, the updated recordset can then be used to update the data in the original table.

This way you can easily verify the correct working of the different steps of the progress (filling the recordset, using recordset data to populate the form, editing data in the recordset, updating original data from the recordset)



Thanks.  Sounds like a little more work than I had hoped for.  A little more  research shows I should be able to have a datagrid, and somehow link it to another page.  This is more of a Master/Detail item - for instance, you see the name and address listed in the first table, clicking on the edit button will show you all of the additional fields of that record on a separate page ready for editing in another grid.

I'm sure there's got to be a fairly straightforward way to have (in Visual Studio) it 'pass' the row to open in the second page for editing without fighting the coding.

you would normally find out the data row you have selected in the master grid (e.g. the row ID).
Then you would use this to populate the detail grid.

You could do this by populating a datatable, which indeed is more work but will be more easily debugged when you encounter problems.
You also could use the following code :

        private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
            int rowID = (int)dataGridView1.Rows[e.RowIndex].Cells[0].Value;
            db6DataSet1.Table_AllDataTable data = new db6DataSet1.Table_AllDataTable();
            db6DataSet1TableAdapters.Table_AllTableAdapter TableAdapter = new WindowsFormsApplication8.db6DataSet1TableAdapters.Table_AllTableAdapter();
            var selection = data.Where(row => == rowID);
            dataGridView2.DataSource = selection.ToList();

Open in new window

Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Akoster - While I appreciate your work, and am jealous of your knowledge, I really want to be able to have it built using the Visual Studio 'easy button' with Gridview and be able to Drill down to the details on the details form.  I have several of these scenarios to set up, and with my limited coding skills I need to do it the easy way for now.
If you want to use only the easy button options, you will be able to get a limited set of data into a gridview.

At the same time you can textboxes which too are linked to the same set of data. When the user clicks on a row in the gridview, the textboxes are automatically filled with the appropriate information.

All this can be done without writing a single line of code.

When however you want things to show up / become editable / spread functionality into different forms etc you will have to use code.
Found the information on how to do it with Visual Studio.  It will use the two grids, and give all the detail I need for each row: 

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial