View Single Post
  #3 (permalink)  
Old April 20th, 2008, 06:37 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

PostBacks and ViewState are not going to help you here. They are used on a page that posts back to itself. In this case, however, you are redirected to a new page which means ViewState from the previous page is lost.

Usually, this is solved by using Query Strings. When you redirect to AddEditReviews you could also send the selected category ID. Then in AddEditReviews you can use that to redirect a user back to the previous page, like this:
Response.Redirect(string.Format("Reviews.aspx?CategoryId={0}", _
       Then in Reviews.aspx you can use Request.QueryString.Get("CategoryId") again to preselect the right categories.

Does that help?

With regards to the Update Cancel issue, I think you probably want to drop the CommandField (which is responsible for the Update and Cancel buttons), and replace it with custom buttons with their CommandName set to the appropriate actions like Cancel.


Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote