Asp.net Multiple Page_Load events for a user control when using URL Routing?

Having tried a number of things I have discovered that if any file has a ../ before it (in an include on any page) it will cause the URL Routing problem described above Simply making sure that no file was referenced using ../ solved the problem entirely - specifically it was the Javascript files that were causing the problem.

Having tried a number of things I have discovered that if any file has a ../ before it (in an include on any page) it will cause the URL Routing problem described above. Simply making sure that no file was referenced using ../ solved the problem entirely - specifically it was the Javascript files that were causing the problem.

That also solved my problem! – FiveTools Apr 16 at 18:52.

It's not clear from your question whether or not you have multiple instances of this user control on the page. If so, I believe (though someone may correct me) that the control's page_load event will be fired for each copy. A way to investigate this issue further is to put a breakpoint in the control's on_load event, and check the call stack each time it stops.It won't give you a definitive cause but, by checking the instance name & ID, etc you may be able to glean some more information.

Which I've now done, the same thing is happening. The call stack doesn't seem to give me a huge amount of information, just literally that that is the first thing called on the page. – Paul Hutson Jan 10 at 8:44.

Its possibly you are trying to pass some querystrinvalues to the user control. Ca n you try passing them normally like below. Test.

Aspx? Var1=sample&var2=test.

Thanks for the reply - I've just tried it with example. Aspx? Nodeid=1&test123=100 : it only runs the page_load once.

However, that means that we've got rid of the URL Routing which we wanted to use (i.e. We're back to the old way of routing to the URLs). – Paul Hutson Jan 7 at 11:27.

Register a route for the Example page, with the NodeID and also the Test123 variables allowed. // This demonstrates how to have several items linked with the page routes. GetRouteUrl("Multiple Data Example", new System.Web.Routing.

// For use when the page loads. // Handle the routing variables. // this handles the route data value for NodeID - if the page was reached using URL Routing.

NodeID = Page.RouteData. // this handles the route data value for Test123 - if the page was reached using URL Routing. Text = "I am the output of the third variable : " + Page.RouteData.

// this handles the route data value for variable - if the page was reached using URL Routing. Text = "I say " + Page.RouteData.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions