Reputation: 201
I have a web page with a drop-down menu. One item of the menu is "Products", which drops-down with 2 sub-items (Suppliers and Parameters), each of these drop-down to show further menu items (i.e. a list of suppliers and a list of parameters respectively). When I select an item from that 3rd level I get redirected to catalogue.aspx, with the supplier or parameter passed as a query string. The menu is written in JQuery, and the links as standard html hyperlinks which just point to catalogue.aspx.
In catalogue.aspx, a list of products are retrieved for the selected supplier or parameter. At the top of the Page_Load method I've put a break point (on the first line of Page_Load). When I first load the catalogue, my breakpoint is hit, and the list of products are retrieved and displayed. However, if I just hit refresh, or try to then view a different supplier, the breakpoint doesn't get hit, and the same products are displayed again. If I look at the URL, the newly selected supplier is shown in the querystring. Select another supplier, still no breakpoint hit, and still the original products are shown. After a while, and several changes of supplier and parameter, the breakpoint finally gets hit and the correct products are returned, but only once and then stops again.
As far as code is concerned, as detailed above all it is is a standard html hyperlink that links to catalogue.aspx (no postbacks), and a breakpoint at the top of the page_load method.
Can anyone advise what might cause this random idiotness of my page?
EDIT: As requested, some code:
The link:
<a href='http://localhost:45745/Website/catalogue/catalogue.aspx?searchby=supplier&searchterm=PMA Service&pid=25&title=Catalogue - PMA Service'>PMA Service</a>
The code-behind:
protected void Page_Load(object sender, EventArgs e)
{
var i = 0;
...
}
The breakpoint is on the line with var i = 0, and I've also put breakpoints in page_load in the master page and the master base page. However neither is being hit so its almost as if the page just isn't debugging, however this issue also occurs on the test site I've put on my server.
Upvotes: 0
Views: 500
Reputation: 201
I seem to have fixed it now, and it does appear that it was down to caching.
I put the following in the page_load of catalogue.aspx
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Now, every time I choose another supplier or parameter it hits the breakpoints and loads the correct products.
Its a bit odd though because the same code is actually used for several websites, with the domain determining which layout/colour scheme/content is displayed. I haven't had the issue with the 3 other websites that already use this code, it's just when upgrading this particular website to the new code that its broken.
Thanks for all the responses.
Upvotes: 1