I’m having the funniest problem here in asp.net. I’m loading nodes from links on different pages. Depending on the link I click on, I get a different node on the diagram. I do this by checking a querystring that I pass to the page with the diagram on it. This works fine, only the first time I click a link. The second time(or any other time) I click on a link the page has the old node on it, and it doesn’t put the new one that I need in the diagram.
In the page load of the page with the diagram I have:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If context.Request.QueryString(“RepCode”) <> Nothing Then
If context.Request.QueryString(“SubSection”) <> Nothing Then
If context.Request.QueryString(“Section”) <> Nothing Then
If context.Request.QueryString(“Exception”) <> Nothing Then
If context.Request.QueryString(“Client”) <> Nothing Then
LoadTopNode adds a node in the following way:
Obviously before this I’ve set the location and other properties properly, because the first time it loads.
Would you know why the first time it passes into this page, it works, and any other time it keeps the first node in the diagram.
What do you mean by “clicking on a link”? Does that click cause a post-back or not? If not, don’t you want to maintain the state of the page (including the GoView et al.) between clicks? I’m guessing that you are not doing a post-back, which is causing a completely new page to be started each time the user clicks on a link. WebForms controls (including GoView) are normally designed to do post-backs, but it appears you aren’t using the normal event mechanism if you are using anchor/HREFs.
Try doing the same thing using an <asp:button runat=“server” …> or something similar.
What I mean is I have a page, and then there’s a link on that page that goes to “./DiagramPage?Section=hello”. It loads this one. Then I go back to another page that has a link “./DiagramPage?Subsection=goodbye”. I click on this link and the diagram still has the hello node and not the “goodbye” node
If you debug your code, does the “goodbye” node actually get added to some document?
Is GoView.EnableViewState true?
Yes, the “goodbye” node gets added with the same code when I step through the code : MyView.Document.Add(node1)
My Control has a view state of false.