Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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
  #1 (permalink)  
Old January 5th, 2007, 07:56 AM
Registered User
 
Join Date: Jan 2007
Location: Surat, Gujarat, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to harsh.kintu
Default Problem in nested master pages.

hi,

friends i am littlebit new in .net 2.0 and i have a problem.
please, help me.

i am using nested master pages in my project.
one is :
Front.master - > inner.master - > index.aspx
second is :
InnerFront.master - > inner.master - > aboutme.aspx

here, i have to call Page_PreInit method of inner.master, so it will select the master page according to requested URL.
if it is index.aspx then it will select Front.master
else it will select InnerFront.master.

i am unable to call PreInit method from Page(ex. : index.aspx)

from,
Harsh Pandit
kintu designs
  #2 (permalink)  
Old January 8th, 2007, 07:39 PM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well you wouldn't call pre_init, you would handle it if necessary by overriding it. It will always be called before the page loads on every iteration of the page life cycle. It will be called regardless of whether you handle it for yourself or "call it". At least thats my understanding of it. I think you should create a base page class that inherits from Page, handle the pre_init event in that, then inherit the base page class in every aspx page. Then in the pre_init handler you would check the request to see what page was requested and specify what master page to load dynamically. This blog post does a much better job of expaining it than I do:

http://www.odetocode.com/Articles/450.aspx

Good luck.
  #3 (permalink)  
Old January 9th, 2007, 10:04 AM
Registered User
 
Join Date: Jan 2007
Location: Surat, Gujarat, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to harsh.kintu
Default

thanks a lot Neil.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Pages Jayahar ASP.NET 3.5 Basics 1 September 2nd, 2008 04:20 PM
Problem accessing Request.Form with Master Pages kittu_asa ASP.NET 2.0 Basics 1 February 28th, 2008 09:38 AM
Problem accessing Request.Form with Master Pages niceFEPF ASP.NET 2.0 Basics 7 February 14th, 2008 04:25 PM
Master Pages, Content Pages and CSS carliviris Visual Studio 2005 0 January 8th, 2008 05:56 PM
strange "errors" with nested master pages... thenoseknows ASP.NET 2.0 Professional 2 November 28th, 2006 05:28 PM





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