I've spent all afternoon trying to do this using CODE BEHIND without success so I am asking for some C# code.
Basically, I have a GV and a DV in a master/detail relationship. If I click Select on a GV row, I want to see its ID, Name and Address in DV.
These data modification capabilities can be plugged directly into a data source control without a line of code needing to be written.
An Overview of Inserting, Updating, and Deleting examined using the Object Data Source to facilitate inserting, updating, and deleting with the Grid View, Details View, and Form View controls.
I know how get this to work declaratively in an aspx file.
But in C# code behind, I don't know how to proceed at this function: Here's a general solution showing you how to achieve this, please note that this solution isn't extremely error-safe but I suppose you'll get the jist of it.
With the Sql Data Source, we need to provide SQL statements (or stored procedures) to execute.
The command buttons for a Details View control are similar to the command buttons for a Gridview control.
At first I put all my code in text, then I got the message it was firing the Mode Changing event which wasn't handled so I put that method back as code to use.
The problem remains, I still have to click twice before I go to Edit mode and Editing doesn't work.
You do this by using the little helper in the upper right hand corner of the detailsview (in design mode), chose Edit Fields, Command Field, then convert to template (as in the picture below).
Then, you will have something like this: Peter is a software professional specializing in mobile and web technologies. In addition, he's a multi-course video author at Pluralsight.