|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 ![]() |
|
#2
|
||||
|
||||
|
Quote:
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:
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. |
|
#3
|
|||
|
|||
|
How can I set the PreInit event for example? I'm using c# btw.
|
|
#4
|
||||
|
||||
|
Code:
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
etc.etc
}
or type preinit into google |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > ASP.NET - Setting MasterPage |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|