master-pages

How to use dynamic master page in ASP.NET MVC RC 1.0

不问归期 提交于 2019-11-30 16:34:08
I don't know how to using dynamic master page in ASP.NET MVC RC 1.0. Please help! You can specify the name of the master page when using the View() helper method: return View("About", "AlternateMaster", model); AlternateMaster would resolve to ~/Views/Shared/AlternateMaster.master Found this here I got this to work by creating a base controller that handled the OnActionExecuted event. In the OnActionExecutedevent I assign the master page. Then I made all my other controllers inherit from the base class. public class BaseController : Controller { protected override void OnActionExecuted

Base URL in ASP.net Master Pages with virtual Directories

我怕爱的太早我们不能终老 提交于 2019-11-30 14:22:11
问题 I have an ASP.net master page. In this master, I have all my css and javascript files defined. I also have a few images and a few buttons and hyperlinks. All the urls are all declared as relative ie "/scripts/ian.js" Everything works fine if this site is the root website, but I need it to work in a virtual directory. My problem is when I place this website in a virtual directory under a root site, all my links are pointing to the root site. so my links point to www.root.com/scripts/ian.js but

ASP.NET Master Pages equivalent in Java

早过忘川 提交于 2019-11-30 14:21:21
What would be the Master Pages equivalent in the Java web development world? I've heard of Tiles, Tapestry and Velocity but don't know anything about them. Are they as easy to use as Master Pages? I want something as easy as set up one template and subsequent pages derive from the template and override content regions, similar to Master Pages. Any examples would be great!! Dwight Holman First, the equivalent of ASP.Net in Java is going to be a web framework, such as the ones you mention (Tiles, Tapestry and Velocity). Master pages give the ability to define pages in terms of content slotted

Preferred way to include relative reference to JavaScript in VS 2008 nested Masterpage

心不动则不痛 提交于 2019-11-30 13:57:27
Our base Masterpage has something like the following <head runat="server"> <title></title> <script type="text/javascript" src="<%= Page.ResolveClientURL("~/javascript/actions.js")%>"></script> <script type="text/javascript" src="<%= Page.ResolveClientURL("~/javascript/jquery/jquery-1.2.6.min.js")%>"></script> <asp:contentplaceholder id="cph_htmlhead" runat="server"> </asp:contentplaceholder> </head> If this Masterpage is the Masterpage for an ASPX page things work fine. If this Masterpage is the Masterpage for a child Masterpage and then a new ASPX page uses the child Masterpage as it's

Set Property Value on Master Page from Content Page

那年仲夏 提交于 2019-11-30 09:44:49
I need to pass data to a variable in my master page each time a page is loaded. I have a string[] of RequiredRoles that I set on each content page defining what roles are required to access that page. On my master page, I have a method that takes this array, and checks to see if the current user is in one or more of those roles. How would I go about managing this? I basically want each page to have a String[] RequiredRoles defined, and the master page will load this on each call and check to see if the users are in those roles. Michael Kniskern Create a property in your master page and you

How to fix namespace problem with autogenerated Master property if MasterType is set

微笑、不失礼 提交于 2019-11-30 08:44:09
问题 after weeks of having this issue I finally decided to ask for a solution to the following problem: In the .aspx page you can set <%@ MasterType VirtualPath="~/Mastername.master" %> This results in an auto generated property in the .aspx.designer public new Mastername Master { get { return ((Masternamee)(base.Master)); } } Works perfectly fine. But if I do changes in the .aspx file, the property will be new auto generated and it looks like the following: public new NAMESPACE1.Mastername Master

Dynamically changing Master Template in ASP.NET MVC

拜拜、爱过 提交于 2019-11-30 07:35:47
I have the requirement to support different Master pages on my application (ASP.NET MVC). What is the recommended way to: Pass the master page name to the view from. Store the master page (in session, or something) so it sticks during a user's visit. Use a custom base controller and inherit from it instead: Public Class CustomBaseController Inherits System.Web.Mvc.Controller Protected Overrides Function View(ByVal viewName As String, ByVal masterName As String, ByVal model As Object) As System.Web.Mvc.ViewResult Return MyBase.View(viewName, Session("MasterPage"), model) End Function End Class

MVC Layout VS MVC Master Page

不羁的心 提交于 2019-11-30 06:21:28
I'm starting learning MVC4. I came across the two possibilities of creating a View based on a Razor template or a Master Page. I would like to understand the practical differences between the two . For now, I can see that if I create a View using a Master Page, I can override several sections. For example, if my Master defines a "left column" placeholder and a "body" placeholder I can not only define the body for a specific View, but I can also render contents in the "left column" section for example to display controls that are bound to the context in which the page is (from a search box to a

How to call content Page function from Master Page

一个人想着一个人 提交于 2019-11-30 05:59:43
问题 It is necessary to call content Page function from Master Page. Please let me know if more data needed. MasterPage.master.cs looks like protected void Required_Function(object sender, EventArgs e) { // call Update_Content_Page() from content page } Default.aspx looks like <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="contentPlaceHolder" Runat="Server

Twitter bootstrap + asp.net masterpages, how to set navbar item as active when user selects it?

折月煮酒 提交于 2019-11-30 02:04:32
We are in se same situation as question Make Twitter Bootstrap navbar link active , but in our case we are using ASP.net and MasterPages... The thing is the navbar is defined at the masterpage and when you click a menuitem you are redirected to the corresponding child page so how would you do to change the navbar active item consecuently without replicating the logic in each child page? (Preferably without session variables and javascript only at master page) We solved it with the following function at Master Page: <script type="text/javascript"> $(document).ready(function () { var url =