Troubleshooting Personal Website Starter Kit

  • Thread starter Thread starter Jonathan Wood
  • Start date Start date
J

Jonathan Wood

Okay, I've spent considerable time trying to figure out why I get random
problems when browsing the images in the Personal Website Starter Kit.
(Note: I found a number of these sites on the Web, and all their photos
browse just fine. Something is screwy even after recreating the database.)

Although a few things are going on, one is that the navigation buttons stop
working at some random point. When I click them, the page appears to refresh
but it then shows the same image.

The navigation buttons are part of a FormView's ItemTemplate and look like
this:

<div class="buttonbar">
<a href="Albums.aspx"><asp:image ID="Image2" runat="Server"
skinid="gallery" /></a>
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:ImageButton ID="ImageButton1" Runat="server" CommandName="Page"
CommandArgument="First" skinid="first"/>
<asp:ImageButton ID="ImageButton2" Runat="server" CommandName="Page"
CommandArgument="Prev" skinid="prev"/>
<asp:ImageButton ID="ImageButton3" Runat="server" CommandName="Page"
CommandArgument="Next" skinid="next"/>
<asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Page"
CommandArgument="Last" skinid="last"/>
</div>

So I wrote an event handler like this:

protected void FormView1_ItemCommand(object sender,
FormViewCommandEventArgs e)
{
litComment.Text = String.Format("{0}: {1}/{2}",
DateTime.Now, e.CommandName, e.CommandArgument);
}

Initially, this creates a comment that is as expected each time I click a
navigation button. But at some point, this event is no longer called! Again,
when I click a navigation button, the page appears to refresh but the time
string is exactly the same (as are the command name and argument). What on
Earth could cause the event to stop being called?

I've searched the Web and not seen a description of anything like this.
Could it be related to running older code on ASP.NET 3.5?

If anyone has a suggestion on what I might try next, I would love to hear
it.

Thanks.
 
Okay, after some speculation, I decided to change the line:

<%@ OutputCache Duration="60" VaryByParam="None" %>

To:

<%@ OutputCache Duration="1" VaryByParam="None" %>

And... it appears to work.

So, I don't really understand ASP.NET caching yet. On the one hand, it makes
sense that it would stop working as it was simply returning the cached
version of the page. But then how did this ever work for anyone, and how
come it's working for other people. Is anyone able to shed some light on
this?

Thanks.
 
Back
Top