Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 February 18th, 2008, 06:48 PM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default AddEditArticle.aspx

Wondered if anyone else has come up with a solution for this.

When Adding/Editing an article, clicking insert/update reloads the page but the article fields are all blank due to DetailsView going into Insert Mode.

I find this a bit frustrating so would rather it just post back to the article i.e. ShowArticle.aspx?ID=....

Has anyone done something similar. Just curious as to the best event handler to use for this, I thought the Updated event of my details view.

Thanks,
Retro

 
Old February 19th, 2008, 12:33 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Yes, that'd be the place to do it.

Be sure to add the following declaration to your DetailsView in the aspx page:

OnItemUpdated="dvwArticle_ItemUpdated"

Then, in the code behind, add the following event handler:

protected void dvwArticle_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
  {
      this.Response.Redirect(String.Format("~/ShowArticle.aspx?ID={0}", e.Keys["ID"].ToString()), true);
  }


You could also do something similar with ItemInserted if you want.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in AddEditArticle.aspx learningASP BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 May 31st, 2007 08:15 PM
AddEditArticle.aspx - validation error emilypost BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 May 31st, 2007 02:55 PM
New.aspx works but login.aspx fails Validation nigelhamilton BOOK: ASP.NET Website Programming Problem-Design-Solution 8 September 13th, 2004 02:29 AM
HowTo Pass Form data from Page1.aspx to Page2.aspx dati ASP.NET 1.0 and 1.1 Basics 6 January 27th, 2004 06:57 AM





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