Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2008, 05:43 AM
Authorized User
 
Join Date: Jan 2007
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

to

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.

Thanks,
Terry
 
Old April 20th, 2008, 05:51 AM
Authorized User
 
Join Date: Jan 2007
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think I mean viewstate or something... sorry, it's just before 4 am and I've been at it for about 3 hrs.
 
Old April 20th, 2008, 06:37 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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:
Code:
Response.Redirect(string.Format("Reviews.aspx?CategoryId={0}", _
       Request.QueryString.Get("CategoryId"))
       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


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
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.
 
Old April 20th, 2008, 03:44 PM
Authorized User
 
Join Date: Jan 2007
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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,

Terry






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 12 (page 400) Try It Out: Applying Filter Deepeshk BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:18 AM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM
Minor textual error chapter 12 bottom of page 406 haguna BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 0 April 16th, 2006 05:48 PM





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