Thanks Karl
I tried that, but I think I need to store the variable for more than one
hit...
Therefore I have tried using Session.Add to store the variable instead -
again this works fine for the first attempt, but I don't seem to be able to
overwrite the session variable in the same way.
If on the first click of the datagrid I use Session.Add("Name", value) the
Server.Transfer takes me to the correct page and retireves data correctly
according to the variable stored on the previous page - all good...
I then click BACK in the browser which displays my datagrid again - I choose
another record in the datagrid and use, obviously, the same Session.Add code
as the first time - Is something going wrong here ? Am I using Session.Add in
the correct way - is it supposed to overwrite the content of the session
variable when it is not null ? I have an inkling that this is something to do
with the fact that I click BACK ?
I Am Confused.... any more ideas would be great !
Thanks again
"Karl Seguin" wrote:
Stuart...the cache isn't the right object for the job. Cache is shared
amongst all users..so you'll run into all types of
race-conditions...Consider placing things in the HttpContext.Item
collection...you can read more on this at:
http://odetocode.com/Articles/111.aspx
and on storage objects in general at:
http://www.openmymind.net/DataStorage/index.html
I think this will be the irst step in solving your problem.
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Stuart" <St****@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com... Hi there
I am using the following to take an account number from a datagrid in to
another page and use it to load specific details according to the account
number:
Public Sub CustomerSearchGrid_ItemCommand(ByVal source As Object, ByVal e
As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
CustomerSearchGrid.ItemCommand
If e.Item.ItemIndex >= 0 Then
Dim Ownercell1 As TableCell = CType(e.Item.Controls(1),
TableCell) Cache.Insert("SearchAccountNumber", Ownercell1.Text & "%")
Server.Transfer("/Application/CustomerBasicInfo.aspx")
End If
End sub
*****
This works fine when the user clicks the grid the first time - but if the
BACK button is used in the browser and another entry in the datagrid
selected, the first selection remains in the cache and the first record
keeps coming back. If you hit refresh in the browser it intermittently works
correctly - but obviously this is not acceptable.
It would seem to me that the cache is not refreshing itself - I have tried
using cache.remove infront of the above but it makes no difference.... I
feel I am missing something obvious here.
If anyone knows - I would appreciate your input.
Thanks
Stuart