473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

putting code in master page Page_Load event moves everything on the page down 2 lines?

I put some code in the master page load event and find that for some reason,
all of the stuff on the page got moved down 2 lines. Is there any way to fix
this?

Nov 5 '07 #1
2 2151
Depends on what you put in the page load event - - can you show us what you
put in there?

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"Sunfire" <a_*****@sbcglobal.netwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
>I put some code in the master page load event and find that for some
reason, all of the stuff on the page got moved down 2 lines. Is there any
way to fix this?

Nov 5 '07 #2
Here is my page_load event in full:

protected void Page_Load(object sender, EventArgs e)

{
//get the file name so we can test for its existance.

String PageName = Path.GetFileName(Request.FilePath);

switch (PageName)

{

case "index.aspx":

MainMenu.Items[0].Enabled = false;

break;

case "AboutUs.aspx":

MainMenu.Items[1].Enabled = false;

break;

case "InHim.aspx":

MainMenu.Items[2].Enabled=false;

break;

case "OnlineCommunity.aspx":

MainMenu.Items[3].Enabled=false;

break;

case "Links.aspx":

MainMenu.Items[5].Enabled=false;

break;

case "Events.aspx":

MainMenu.Items[6].Enabled=false;

break;

case "ContactUs.aspx":

MainMenu.Items[7].Enabled=false;

break;

}

}

"David Wier" <dw@dw.comwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
Depends on what you put in the page load event - - can you show us what
you put in there?

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with
no bloated markup
"Sunfire" <a_*****@sbcglobal.netwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
>>I put some code in the master page load event and find that for some
reason, all of the stuff on the page got moved down 2 lines. Is there any
way to fix this?


Nov 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jeff Lynch | last post by:
I need to call a class on every web page in a site. In ASP.NET 1.1 I would call this class before the Page_Load event in each web page's code-behind file since it needs to run before the web page...
7
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage...
5
by: Howard | last post by:
i have a default.master and default.aspx in default.aspx i would like to access a variable in default.master pageTitle public partial class _Default : System.Web.UI.Page { protected void...
3
by: Brian | last post by:
Master pages run Page_Load() from the deepest level of nesting outwards. So if I write a content page based on a nested master which is then based on some other master, the Page_Loads are executed...
1
by: kajsa.linderborg | last post by:
I have a problem with getting my aspx-pages with a master page to understand that I have written something in my controls in the Page_Load-event of the content-page. I have a simple page with a...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
4
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null....
4
by: David C | last post by:
I spent the last four hours trying to figure out why Page_Load would execute twice. Even stranger was that everything within if (! IsPostBack){....} executed twice as well. There is no rhyme or...
6
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.