Hi bjavierto,
The first issue is more or less by design. Since you're only working with a single page that uses User Controls, not the entire page is refreshed when you add a new Entry. If you look at the EndEditing method in the BlogEntries.ascx control, you see that only the BlogEntries list is reloaded, not the BlogEntriesFilter (as that one is not accessible from the BlogEntries.ascx control).
If you don't like this behavior, there are a few ways to fix it:
1. Change the code for EndEditing to something like this:
Response.Redirect(Request.CurrentExecutionFilePath )
This redirects the parent page to its current location again, effectively reloading the page. You could add some additional code to maintain querystring variables, so you stay in the same calender period or category.
2. You could add an Event on the BlogEntries.ascx controls that fires when you add a new item. The Default.aspx page could listen to that event, and reload the BlogEntriesFilter.ascx control correctly when a new item is added.
Re your second remark: this is a caching issue. You'll find that when you refresh the page using Ctrl+F5 (in IE) that the button disappears. This is because you now have a clean, fresh copy from the server that doesn't include the button.
One solution is to control the caching of pages through your web server (IIS). Alternatively, you can instruct the Cache object on the Response to not cache the page. To do this, add the following code to the Page_Load of Default.aspx"
Code:
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Response.Cache.SetCacheability(HttpCacheability.NoCache)
End Sub
or in your case in C#:
Code:
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
}
Now the page won't be cached. So, when you click the Back button you should get a fresh copy from the server without the Create New Entry button....
Glad you like the book and find it fun to read.....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004