p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 (http://p2p.wrox.com/forumdisplay.php?f=389)
-   -   Chapter 12: Page 410 - Try it out (http://p2p.wrox.com/showthread.php?t=67549)

VeganMan April 20th, 2008 05:43 AM

Chapter 12: Page 410 - Try it out
I'm enjoying chapter 12 so much that I am taking my time and experimenting. LOL

I was wondering if you could give me some hints on how to deal with the following problems (just hints so I can try to figure it out myself):

When I click on Jazz in the Reviews page, then on a title, I go to the AddEditReviews page. I have no way of going back to the Reviews page while (postback ?) where it remembers the list of items under Jazz. I have to click refresh and choose the item again.

Do I use need to create some sort of postback to remember???

When you click the cancel button, it clears the form is there is text in it. Can you give me a few hints on how to do the following:

1.) Create a postback so it will remember the item I chose while it displays the list.

2. Change the details view from

Update | Cancel


Update | Clear | Cancel

where Clear will do what cancel presently does and the new Cancel will postback to the Reviews showing the title and list of items previously chosen.

I hope I haven't confused you.


VeganMan April 20th, 2008 05:51 AM

I think I mean viewstate or something... sorry, it's just before 4 am and I've been at it for about 3 hrs.

Imar April 20th, 2008 06:37 AM

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.

VeganMan April 20th, 2008 03:44 PM

Does it help? I said a hint, not tell me how to do it, hahaha.

I must have read and heard that PostBacks and ViewStates to itself 100's of times but I keep forgetting. This time I think I will remember. You gave me enough info to know what I need to look for to make the changes.

Appreciated Imar,


All times are GMT -4. The time now is 10:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.