Datalist - How to Know ID From Underlying DB

V

Verde

Suppose I load a DataList up with a bunch of records from an underlying
Database. The DataList shows an Edit and a Delete button. Each record in
the database has a unique Integer ID value.

Now, during PostBack processing, how I (my code) know what the ID value is
for any given row shown in the DataList?

For example, I want to delete a record from the underlying database. I view
the Datalist in the browser, then click the Delete button. How can the
PostBack processing logic (in the MyDataList_ItemCommand() event procedure)
"know" the ID value for the row to be deleted - so it deletes the correct
row from the underlying database?

Note: e.Item.UniqueID is of no help here because that's the ASP.NET-assigned
ID - not the ID from the underlying database.

Thanks
 

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

Top