View Single Post
  #2 (permalink)  
Old February 2nd, 2007, 02:52 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,

The problem is related to the order of events; Page_Load fires before the other events.

There are two ways to fix this:

1. Create a method on the User Control called UpdateList for example. Inside this method call GetCategories() and DataBind() as in the code below to update the list.
In the Save button's Click event, call UpdateList on the user control to force it to update the list.

2. Simply do a full redirect after the save operation:

  Response.Redirect("~/")

should do the trick as well.

HtH,

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.