.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 1st, 2008, 07:20 PM
Raytheon Raytheon is online now
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 89 Raytheon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 5 h 44 m 53 sec
Reputation Power: 5
ASP.NET - Setting MasterPage

Does anybody know how to set the MasterPage for an existing web form? When I try to set the property it is grayed out and cannot be changed.

Also, how do you set an event for a web form like in windows applications? Because I can't see the list of events for the form?

Thanks

Reply With Quote
  #2  
Old May 2nd, 2008, 06:47 AM
danielk's Avatar
danielk danielk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Earth
Posts: 207 danielk User rank is Lance Corporal (50 - 100 Reputation Level)danielk User rank is Lance Corporal (50 - 100 Reputation Level)danielk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 23 h 20 m 15 sec
Reputation Power: 4
Quote:
Originally Posted by Raytheon
Does anybody know how to set the MasterPage for an existing web form? When I try to set the property it is grayed out and cannot be changed.


Make sure you have created your web form as a "Web Content Form". Then view source / html. Locate the first line and you should see MasterPageFile. Change this to what you require.
You can also set this at runtime using Page.MasterPageFile = "SomeMasterPage.Master", but you need to do it during the PreInit stage (can't be done during the PageLoad stage).

Quote:
Also, how do you set an event for a web form like in windows applications? Because I can't see the list of events for the form?

What events do you need to set? Note that web forms work differently to windows forms. The main event you would use for a web form is Page_Load. You can also use PreRender, PreInit, etc, but Page_Load is the main one. Other controls such as buttons, text boxes, GridViews have events that are more similar to win forms.

Reply With Quote
  #3  
Old May 3rd, 2008, 07:28 AM
Raytheon Raytheon is online now
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 89 Raytheon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 5 h 44 m 53 sec
Reputation Power: 5
How can I set the PreInit event for example? I'm using c# btw.

Reply With Quote
  #4  
Old May 3rd, 2008, 07:40 AM
danielk's Avatar
danielk danielk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Earth
Posts: 207 danielk User rank is Lance Corporal (50 - 100 Reputation Level)danielk User rank is Lance Corporal (50 - 100 Reputation Level)danielk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 23 h 20 m 15 sec
Reputation Power: 4
Code:
protected override void OnPreInit(EventArgs e)
{
    base.OnPreInit(e); 
    etc.etc
}


or type preinit into google

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > ASP.NET - Setting MasterPage


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway