I have 8 hyperlinks that are accessible once the user hovers over my menu item called ‘Recent Contacts’, located on my Master Page. The hyperlink text displays names of contacts’ records previously displayed. When the user selects a new contact from my datagrid I want to update the 8 hyperlinks so that hyperlink 1 text now displays the name of the newly selected contact. The contact name previously displayed on hyperlink 1 will now be held on hyperlink 2, 2 will be held on 3, 3 on 4 and so on. So the 8th contact name listed as hyperlink 8 will disappear and be replaced with the contact name previously displayed on the the 7th hyperlink.
When the user clicks on hyperlink 2 (for example) he/she will be redirected to a new page displaying the contact’s full record. I therefore need to hold 2 items in session state (contactid and contact name). I think I can do this by using an array and session object. Think I’d do something like:
- Read session object data (contact id and contact name) and write it to an array variable.
- Get the contact id and contact name from the new contact selected from my data grid
- Write this new contact data (id and name) along with the first 7 items of the array varibale into a new array variable.
- Remove the session object (unless you can just delete all array items?)
- Recreate (or refill) a new session object with data from my second array
- Amend the text for my 8 hyperlinks
I’m quite new to ASP.Net. How do I write the first 7 items of my array to a session item. I guess my session item needs to be an array 2 columns wide with 8 rows?