master-pages

How to pass viewmodel to a layout/master page?

╄→尐↘猪︶ㄣ 提交于 2021-02-17 21:30:55
问题 Having googling for some time, I'm a little bit confused with how to do this in asp mvc 3. So, the task is to have a common layout (or master?) page for several controllers' views. All the views are strongly-typed themselves... This layout page in fact visualizes some strongly-typed object. So, I need this object to be passed to the layout page to pass it to `Html.RenderPartial()' or to render it right in the page. The article Passing Data to View Master Pages (C#) (though an old one for mvc2

Can a page inherit multiple master pages?(ASP.NET)

我只是一个虾纸丫 提交于 2021-02-08 12:48:12
问题 Can a page inherit multiple master pages?(ASP.NET) 回答1: No but you can use nested master pages. Here is some reference Nested ASP.NET Master Pages 回答2: A single page cannot inherit two different master pages. If you think about it, that should be relatively obvious. How could it be possible? What would it do? However, one master page can inherit a second master page. 回答3: You can nest as many master pages as you would like. MSDN link on how to nest master pages 回答4: A single page cannot

How do I keep the master page from flickering?

本秂侑毒 提交于 2020-03-05 02:00:51
问题 I am building an ASP.NET application and would like to use a master page to display branding and navigation info and move through several content pages. However, every time I try to load new content the entire page flickers. Is there anyway to avoid this? Master page: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Interface.Site" %> <%@ Register TagPrefix="customControl" TagName="NavigationBar" Src="NavigationControl/NavigationControl.ascx" %> <!DOCTYPE

How do I keep the master page from flickering?

醉酒当歌 提交于 2020-03-05 01:59:55
问题 I am building an ASP.NET application and would like to use a master page to display branding and navigation info and move through several content pages. However, every time I try to load new content the entire page flickers. Is there anyway to avoid this? Master page: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Interface.Site" %> <%@ Register TagPrefix="customControl" TagName="NavigationBar" Src="NavigationControl/NavigationControl.ascx" %> <!DOCTYPE

Applying style to nested pages in a master page

拟墨画扇 提交于 2020-02-04 04:06:14
问题 Why could I be unable to apply style on a nested page which is using a master page? I am just trying to apply simple some back-color to body and some div in an individual page. My (nested)page Reservations.aspx has this code <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Reservations.aspx.cs" Inherits="Reservations" %> <asp:Content runat="server" ContentPlaceHolderID="HeadContent"> <link href="~/Styles/input.css" rel="stylesheet" type=

Applying style to nested pages in a master page

僤鯓⒐⒋嵵緔 提交于 2020-02-04 04:06:11
问题 Why could I be unable to apply style on a nested page which is using a master page? I am just trying to apply simple some back-color to body and some div in an individual page. My (nested)page Reservations.aspx has this code <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Reservations.aspx.cs" Inherits="Reservations" %> <asp:Content runat="server" ContentPlaceHolderID="HeadContent"> <link href="~/Styles/input.css" rel="stylesheet" type=

ASP.NET Controller Base Class User.Identity.Name

浪尽此生 提交于 2020-01-31 18:16:28
问题 As described in this post, I created an abstract base controller class in order to be able to pass data from a controller to master.page. In this case, I want to lookup a user in my db, querying for User.Identity.Name (only if he is logged in). However, I noticed that in this abstract base class the User property is always null . What do I have to do to get this working? Thanks a lot 回答1: As Paco suggested, the viewdata isn't initialized till after you are trying to use it. Try overriding

MVC, Get MasterPage path from inside a view

余生颓废 提交于 2020-01-24 00:58:06
问题 How can i get the path of the MasterPage from inside a view, I tought that ((WebFormView)Html.ViewContext.View).MasterPath would do the trick, but unfortunately, it's always empty. so how do I get it? 回答1: I'm nto sure what you need exactly, but the View should have a MasterPageFile property that contains the relative path to the MasterPage. You can use MapPath if you need the physical location. <%= this.MasterPageFile %> <%= MapPath( this.MasterPageFile ) %> 来源: https://stackoverflow.com

jQuery UI Multiple Select not working in .aspx page that is content for a master page

好久不见. 提交于 2020-01-23 19:00:29
问题 I'm trying to use this jquery plugin (http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/) on an aspx page with many different gridviews. The page code is within an asp:content tag. I'm placing my select options in an asp:view outside of an asp:gridview. The page uses a master page. I have the multiselect widget working in a blank page, but I can't get it to work with my master page. I've tried adding my css/script links/document.ready() in the gridview I'm using it with. I've tried

jQuery UI Multiple Select not working in .aspx page that is content for a master page

[亡魂溺海] 提交于 2020-01-23 19:00:07
问题 I'm trying to use this jquery plugin (http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/) on an aspx page with many different gridviews. The page code is within an asp:content tag. I'm placing my select options in an asp:view outside of an asp:gridview. The page uses a master page. I have the multiselect widget working in a blank page, but I can't get it to work with my master page. I've tried adding my css/script links/document.ready() in the gridview I'm using it with. I've tried