I'm trying to write an asp.net app which searches a sql db and returns/updates the data.

I want to be able to hold the currently selected id of the item my user has selected. For example a doctors surgery would select a patient record then be able to browse the app without having to re-select that patient on each page.

What would be the best way to do this. Ideally I need to be able to get this ID application wide. the only thing i can think of is to create a public class, store the id and make it public but this seems quite messy :S

Thank you

which Asp:control is shows Data?
usually data controls has a property named: dataKeyName.

If u use asp:dataControl u must set dataKeyName.
for example


remember that session states uses server memory.
that means session can reduce your server performance