Associated DropDownList of "unused" elements plus the current row in the EditItemTemplate GridView?

I have two tables with unique identifiers that can be mapped to each other (one table comes from a database outside my application, but has information about the same objects that I'm tracking). I want to provide a user interface for associating "my" records with "others", so I can store the "other" IDs in my table for the corresponding records. In short, a key element of the user interface is a drop-down list showing available (i.e., not yet related) records from a "different" table.

I have a gridview to display "my" records in each row, plus a column showing some information from a related record in a "different" table, if any. Data on buildings and properties, so it may look like this:

Building1   Dallas   TX    Building1_Dallas_TX
Building2   Memphis  TN    Bldg2_Memphis_TN
Building3   Denver   CO
Building4   Seattle  WA
Building5   Boston   MA    Building5_Boston_MA

where the first 3 columns show some information from the "my" table, and the last shows the matching record from the "other" table, where the records are already connected, otherwise a space where the link is not set. My actual gridview has a few more columns from the “my” table, but that’s enough to illustrate the need.

"" ( ), 4 . 3 ; , "" , "" ( ), "" , ( , ​​) ( "", , ).

RowEditing gridview ( Unassigned, ListItem .aspx AppendDataBoundItems, true), SelectedValue ddl DataBound, , " ", ddl ( " " ), . , , - ddl , , . ddl , , , , , , , , .

ddl SqlDataSource SelectCommand, , ( "" , GridView DataKey ControlParameter SelectParameters SqlDataSource. ddl .

- ! - , , ... , , , .

!

+3
1

, , , , , .

, , SQL, . "WHERE xx NOT IN". "" , .

- GridView . , .

, .

0

Source: https://habr.com/ru/post/1732489/


All Articles