View Single Post
  #7 (permalink)  
Old February 2nd, 2007, 11:37 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alan,

Yeah, it's a difficult problem, because the functionality is embedded in User Controls. To promote reuse, you can't strongly couple the controls. So, although you technically could, you shouldn't find a reference in control A to control B and call some method.

Instead, you should base this on Events. The BlogEntry control should fire an Event called OnBlogEntrySaved (or whatever you want to call it). The containing page handles this event (similar to how it handles a Button's click) and then calls RefreshGridView on the other user control.

For an implementation of this, look at the WebShop chapter. The ShoppingCartView.ascx control defines an event called CartUpdated that is used to signal other parts of the application that the shopping cart has changed.

However, if you want to do this much and much simpler, simply redirect to:

Response.Redirect(Request.CurrentExecutionFilePath )

In addition, to preserve the querystring, look at GetNavigateUrl in the BlogEntriesFilter control.

Hope this helps,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.