master-pages

ASP.NET Masterpages and viewstate

I am looking to improve the performance of my site, not because it is performing badly but just as a general exercise. The usual suggestion for asp.net sites is to remove viewstate wherever possible. I believe this can be done by each control on a page separately or for the whole page. My question is if I disable the page viewstate will...

Events and Delegates with ASP.NET master pages

How do you catch a custom event raised by a master page? On my master page I have a custom event and delegate: public event SignOutHandler SignOut; public delegate void SignOutHandler(); This is raised when a link button on the master page is clicked. if (SignOut != null) { SignOut(); } In a user control on the page I'd like to s...

Setting the Body's OnLoad attribute in an Asp.net MVC Master Page

I have a view using a master page that contains some javascript that needs to be executed using the OnLoad of the Body. What is the best way to set the OnLoad on my MasterPage only for certain views? On idea I tried was to pass the name of the javascript function as ViewData. But I dont really want my Controllers to have to know about t...

Master Pages fail to recognize new controls

So, from my experience, masterpages sometimes can lag when you do updates. This is not a new occurance, you make a change, you build, you go to test and the MasterPage is still looking for the old control. Anyone have any tips/tricks they use when this happens? Usually it goes away after a while, but I don't have a while. I am using ...

How to Dynamically add menu items to master page in ASP.NET 3.5 MVC app

I want to dynamically add menuitems to my master page based on membership security login role. From what I've read RenderAction in the master page html could perhaps do this. Since I'm fumbling thru this I am not sure how it would look and how in the controller I check my current role. I am considering creating a table and relating the a...

ASP.NET Container-Specific Master Pages for Safari or Chrome

Has anyone been able to create Container-Specific Master Pages for Safari or Chrome? I can't find any ".browser" files for either of these. How often is the %SystemRoot%\Microsoft.NET\Framework\version\CONFIG\Browsers directory updated? Thanks ...

Redirect to controller (but with a different master) using a catchall wildcard

I have a problem whereby I want to display a view differently (a different master page), depending on where it came from, but don't know where to start... I have several routes which catch various different types of urls that contain different structures. In the code snippet below, I have a product route, and then I have a partner site...

MOSS 2007 Breadcrumb problem

I've got a page layout for a publishing site with an odd behaviour. Imagine a publishing site (site) with a subsite (subsite1) which has the following pages (page1 [default], page2, and page3) for page 2 and page three the breadcrumb renders correctly: site > subsite1 > page2 site > subsite1 > page3 however for the default page t...

Dynamic rendering of webpage for logged in users only

When a user logs in to my site I want a css styled button to appear (this could be anything really, i.e. some special news text item etc), how can you do this via masterpages in asp.net? Or is there some other way you do this? ...

Dynamically adding Content blocks to Masterpage fails after Master.FindControl

Hi all, I've encountered an odd problem that doesn't make any sense to me. I am trying to dynamically set up MasterPage Content controls on a page. I have it working nicely with the following code: protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); MasterPageFile = "~/MasterPages/Default.master...

How to store an ASP.NET master page in a common library?

We would like to have several internal web applications which use the same master page. Is there a way to store a master page in a common library referenced by all projects? ...

Master Pages - Design question

Hi, Would you guys think that a master page should be part of the company's framework or it should be part of each application? Or perhaps the company's framework should only have a interface to provide the least functionality to all master pages ? Currenlty we face two problems: Firstly, the original idea was to have a common layout f...

Passing form data from masterpage to other pages ASP.NET

I have asked a similar question before, but I didn't have a firm grasp on what the problem I was encountering was. My problem is I cannot get the data from a TextBox residing on the master when the page changes. Here is what happens: MasterPage with TextBox and Button. Data is entered into the TextBox and Button is clicked. Form's ac...

Is it better to use Nested Master pages or User Controls for multi-sectioned website?

I am creating a website that has 5 different sub-sites each with the same overall look, but each has a different logo and added navigation. What do you feel is a better approach: Use the new nested master page capabilities to create 5 sub-master pages. Use a single master page and dynamically load user controls corresponding to each s...

How to determine which Child Page is being displayed from Master Page?

I'm writing code on the master page, and I need to know which child (content) page is being displayed. How can I do this programmatically? ...

Convert Web Form to Web Content Form after the fact. (.net)

I have a site a few years old that contains about 30 aspx Web Form pages with code behind. I want to add a common master page to all these with the minimum amount of work. Essentially, I just need to add everything in the body tags to the Content Placeholder, and preserve the code behind. Is there a fast way to do this? ...

Best way to implement languages menu in an ASP.NET application

I trying to implement a typical languages menu where users can select the language they want to view the site in through a menu that appears throughout all pages in the site. The menu will appear on multiple master pages (currently one for pages where users are logged in and one for pages where users are not). My current implementation...

Dealing with relative filepaths in ASP.Net and Masterpages

This may be a painfully simply question for which I will be mocked but I am having difficulty in using filepaths in masterpages. I believe this is because if a page in a sub-directory to using the masterpage then the filepath is incorrect. To fix this I need to get the filepath from the root but I can't seem to get it working. I tried:...

How to find all pages that use a Master Page in Visual Studio

Is there a way to find all web pages that implement a specific master page in Visual Studio? I'm looking for a shortcut like shift F12 that will find all usages of a master page. When I do it on the master page class name it only takes me to the design view instead of showing all pages that use it. I do have Resharper if there is somet...

How to use JQuery with Master Pages?

I can get simple examples to work fine as long as there's no master page involved. All I want to do is click a button and have it say "hello world" with the javascript in a .js file, using a master page. Any help very much appreciated :) ...