HELP: Getting row column values in ASP.NET datagrid?

U

Usenet User

I have a datagrid bound to a dataset table.

Unfortunately, the table's primary key consists of not 1, but 3
columns, so I cannot correctly set the DataKeyField property of the
grid (it only allows for 1 column), and, therefore, cannot use syntax
like below in the event handlers in order to retrieve the primary key
of the row:

this.gridList.DataKeys[e.Item.ItemIndex]

I still need to be able to get the values of all 3 key columns, yet I
am not sure how. Any ideas?

TIA!
 
G

Guest

Place the primary keys on the grid using <asp:BoundColumn Visible=False
DataField ="PrimaryKey1" ReadOnly =True ></asp:BoundColumn> In this way you
can retrieve them and locate your records but the user would not see them. I
have an example on this link http://societopia.net/samples/datagrid_4c.aspx
that works based on multiple primary keys to display a child datagrid and to
update the values in the parent grid.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top