datagrid generated with rows from a view and its dillema

D

David

Hello,

I have a datagrid populated with rows from a view. Because they are from a
view, the rows are not actual database records, and therefore lack unique
identifiers.

So I have a command button for each row. When the button is pressed, I want
to go to another page with all the information in that selected row.
Normally I would do this (if the rows are actual records, that is)

//take the datakey value
string selected_id = dgMyDataGrid.DataKeys[e.Item.ItemIndex]

//and do this before tranfering to another page.
Context.Items.Add("uniquekey", selected_id);
Then on the second page, I would take the selected_id and retreive the
record from the database (I've always wondered if that trip to the database
server would be necessary).

But I can't even do this with rows from a view because there is no unique
identifier. But I still want to take the row from the view and give it to
the destination page.
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top