COMP2098 Chapter Notes -Data Binding, Xml, Meridian Regional Airport

69 views3 pages

Document Summary

Selectedindex returns a zero-based index number that represents where the row occurs in the grid. This isn"t the information you need to insert into the query that gets the related records. Instead, you need a unique key field from the corresponding row. For example, if you have a table of products, you need to be able to get the productid for the selected row. In order to get this information, you need to tell the gridview to keep track of the key field values. The way you do this is by setting the datakeynames property for the gridview. This property requires a comma-separated list of one or more key fields. Each name you supply must match one of the fields in the bound data source. Here"s an example that tells the gridview to keep track of the categoryid values in a list of product categories:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions