Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 June 5th, 2012, 02:29 PM
Authorized User
 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 13, Pg 469, error on EndEditing sub

Hi,

I am at Step 16 of the "Try It Out" on page 469, and I am having a problem defining the EndEditing sub. My code is as follows:
Code:
Partial Class Management_AddEditReview
    Inherits System.Web.UI.Page

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Request.QueryString.Get("Id") IsNot Nothing Then
      DetailsView1.DefaultMode = DetailsViewMode.Edit
    End If
  End Sub

  Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles DetailsView1.ItemInserted
    EndEditing()
  End Sub

  Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView1.ItemInserting
    e.Values("UpdateDatetime") = DateTime.Now
  End Sub

  Protected Sub DetailsView1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdatedEventArgs) Handles DetailsView1.ItemUpdated
    EndEditing()
  End Sub

  Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
    e.NewValues("UpdateDatetime") = DateTime.Now
  End Sub
End Class

Private Sub EndEditing()
  Response.Redirect("Reviews.aspx")
End Sub
and I am getting the following errors:

1 & 2, EndEditing is not declared (which I would expect)
3, Statement is not valid in a namespace (on Private Sub EndEditing() statement)

Intelisence would not let me type Response.Redirect either, so I know I am missing something, but I don't have a clue what it is.

Any help is appreciated. Thanks! s.
 
Old June 5th, 2012, 02:34 PM
Authorized User
 
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Never Mind....

Sorry, shot from the hip. I finally realized the subroutine was outside of the "Class" (I placed the subroutine after the "End Class" statement.





Similar Threads
Thread Thread Starter Forum Replies Last Post
EndEditing error vbboyd BOOK: Beginning ASP.NET 4 : in C# and VB 1 April 4th, 2012 05:42 PM
Ch 9 p.469 O/R Design Surface behaior problem Pegasus40218 BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB 0 July 8th, 2010 05:55 PM
Help??!! Error when working in Ch. 13 convert21 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 October 9th, 2009 03:39 AM
Ch 2 pg 70: links throw error subgenius BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 August 16th, 2004 05:26 PM





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