0

Hi
I thought I'd share this with you all as it is really quite simple but I spent ages looking for it.

I have an ASP.Net App with a master page containing a tree view that holds a heirarchy of data (as opposed to site naviagation)

What I wanted was when the user clicked on the Tree the postback event for the tree would fire and I could process what node they had clicked (data level, node values, etc.) which I then store in a session variable and then I wanted to reload the current page with this new data as the page was also holding other data specific to the current node in other variables.

i.e. when not post back, the page wipes these variables and populates with whatever is needed for the new node. During post back event from other controls, I want to keep this data and only react to the postback.

So on my

TreeView_SelectedNodeChange

event I processed the node data then finished off with

Response.Redirect(Request.RawUrl)

to reload the page.

However, I was getting errors because although I had changed and wiped the data the actual page was still treating it as a post back and now had orphaned data.

It turns out I was only half way there! All I needed to do was add a flag to my

Response.Redirect(Request.RawUrl)

call which tells the server to stop executing the current page:

Response.Redirect(Request.RawUrl, true)
1
Contributor
0
Replies
3
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.