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 November 10th, 2009, 03:31 PM
Authorized User
 
Join Date: Oct 2009
Posts: 22
Thanks: 7
Thanked 0 Times in 0 Posts
Default Ch14 Try It Out Pg. 506

Hi,

I'm working on this try it out and for some reason the title for the ViewDetails.aspx page is not being set programmatically and so my basepage template raises an error.

I have this code in the codebehind...
Code:
Partial Class ViewDetails
  Inherits BasePage

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim reviewId As Integer = Convert.ToInt32(Request.QueryString.Get("ReviewId"))
    Dim myReview As Review

    Using db As New PlanetWroxDataContext()
      myReview = (From r In db.Reviews _
                  Where r.Id = reviewId _
                  Select r).Single()
      lblTitle.Text = myReview.Title
      lblSummary.Text = myReview.Summary
      lblBody.Text = myReview.Body

      'Set the page title programmatically
      Me.Title = myReview.Title
    End Using
  End Sub
End Class
Maybe I misspelled something and I'm not seeing it.

Update**
When I set the title to the ViewDetails.aspx in markup everything works fine. The title is changed to the proper one once the page loads. The error is being raised before the Page_Load event is triggered. Why is this happening?


Chuck

Last edited by eiviery; November 10th, 2009 at 03:47 PM..
 
Old November 11th, 2009, 04:47 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
The error is being raised before the Page_Load event is triggered. Why is this happening?
Hard to tell why this is happening without seeing the actual error....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 11th, 2009, 01:37 PM
Authorized User
 
Join Date: Oct 2009
Posts: 22
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Hi,

I am receiving the error that we set up in the base page about the Title of the page being blank.
 
Old November 11th, 2009, 01:49 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Yeah, I see now. Sorry I missed that (a reference to the error was in your original post).

I think you're running into an old, annoying (and unfixed) bug:

https://connect.microsoft.com/Visual...305749#details

Setting the title to a non-empty value in markup before you assign it dynamically is indeed the work-around.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
eiviery (November 11th, 2009)
 
Old November 11th, 2009, 01:58 PM
Authorized User
 
Join Date: Oct 2009
Posts: 22
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Thanks Imar,

While I'm never excited about bugs, I'm relieved that it wasn't something I was doing wrong.

Offtopic: Did you get a chance to take a look at the error list I posted for my other issue?

Complie Issue

^^^^^
*Compile :)

By the way I tried to load the site from my flashdrive on a different desktop and I got the same error concerning the Picture class.

Thanks,


Chuck
 
Old November 11th, 2009, 02:01 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Did you get a chance to take a look at the error list I posted for my other issue?
I just did, three minutes ago.....
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
pgs. 506-512 "r" ? Rachel BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 January 2nd, 2009 05:02 AM
My VB Code for Ch14 PatFrank BOOK: Beginning ASP.NET 2.0 and Databases 8 April 17th, 2007 02:34 PM
Ch14 - timesheets with one row geoffers BOOK: Beginning VB.NET Databases 0 August 24th, 2005 08:48 AM





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