Hello,

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

Recommended Answers

All 3 Replies

Could I use session[id] ?

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

<asp:GridView 
     ID="GridView1" 
     runat="server" 
     [U][B]DataKeyNames[/B][/U]="dr_id,dr_name,dr_family">
</asp:GridView>

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.