master-pages

ASP.NET MVC Master Pages

纵饮孤独 提交于 2019-12-03 08:40:23
问题 What's the difference between the ASP.NET Master Page, and the MVC Master Page? And the AJAX Master Page for that matter? 回答1: Mostly it comes down to the default controls and inheritance. The AJAX Master and ASP.NET Master both inherit from System.Web.UI.MasterPage, while the MVC Master inherits from ViewMasterPage. Obviously, these give you slightly different controls on this - as stated by John Clayton, the ViewMasterPage exposes the Ajax/Html/Url helpers and the like, which are not

How to run jquery script if html page is the home page…?

谁说我不能喝 提交于 2019-12-03 06:02:29
I'm working with an external team with our website and they recently added one of my scripts to the .NET MasterPage of the site... well it did finally get my script running but now... it loads Banners on 'every' page on the site. How can I write an 'if' statement that basically says... if this is the home page... run this script... if not don't...? I'm posting another answer in case you can't implement the Master Page solution. You could use a flag element to tell jQuery it's the homepage, because the URL solutions posted earlier can easily break. Somewhere in your Homepage content, simply

How to reference a Master Page from a user control?

限于喜欢 提交于 2019-12-03 05:35:47
I'm looking for a way to (preferably) strongly type a master page from a user control which is found in a content page that uses the master page. Sadly, you can't use this in a user control: <%@ MasterType VirtualPath="~/Masters/Whatever.master" %> I'm trying to access a property of the master page from the user control and would rather not have to pass the property from the master page to the content page to the user control because multiple content pages use the same user control. One change, one place whatnot. Dan Herbert Try Page.Master . Whatever whatev = (Whatever)Page.Master; You'll

Does master page get called first?

南楼画角 提交于 2019-12-03 05:19:46
问题 I would assume this is true, but wanted to throw this question up. Is the master page executed first in ASP.NET, or does the page which is getting retrieved? I am asking because I want some processing to be done in the master page, results of which are loaded into a static object and which can then be used by the called page (for instance user data) 回答1: Sorry for just quoting, but i don't know what to add: Individual ASP.NET server controls have their own life cycle that is similar to the

I'm new to .NET - what should I concentrate on and what should I ignore?

霸气de小男生 提交于 2019-12-03 02:25:53
问题 So, I've had a fair amount of experience programming database driven web apps using php and coldfusion (not together, at different times) and I'm starting to look into the asp.net world (I have a project coming up at work that is all asp.net/c#.) My question is: there seems to be a lot of stuff to get mired in and if I'm just making web-based applications (mostly CRUD-type stuff - no mind-bending logic) what are the topics I should be focusing on? I just don't want to go down the rabbit trail

Master page in HTML

有些话、适合烂在心里 提交于 2019-12-03 01:16:12
Is there any way to create a similar idea as master/content page in ASP.NET in pure HTML? I want to create several pages in HTML, but I want that all of them look the same with some contents different. Is there any way to do this without creating several pages which are very similar to each other? apohl //wait until the dom is loaded $(document).ready(function () { //adds menu.html content into any "#menu" element $('#menu').load('menu.html'); }); In reference to some of the other answers, iframes should be used carefully and sparingly. http://rev.iew.me/help-moving-from-iframes http:/

Setting an ASP.NET Master Page at runtime

China☆狼群 提交于 2019-12-03 00:22:25
I'm working on a site which needs to be able to support two or more looks, changable at runtime. I'd hoped to be able to handle the change with a CSS switch, but it looks like I'll need to use a different masterpage for each design. So, what's the best way to set the masterpage at runtime? Page.MasterPageFile can only be set in the Page.OnPreInit event. It looks like the solutions are to make all my pages inherit from a common base which handles the PreInit event, or to use an HttpModule which does that. Any advice? I've done this once before, I did exactly what you described (Made all pages

ASP.NET MVC Master Pages

别说谁变了你拦得住时间么 提交于 2019-12-03 00:10:40
What's the difference between the ASP.NET Master Page, and the MVC Master Page? And the AJAX Master Page for that matter? Zhaph - Ben Duguid Mostly it comes down to the default controls and inheritance. The AJAX Master and ASP.NET Master both inherit from System.Web.UI.MasterPage, while the MVC Master inherits from ViewMasterPage. Obviously, these give you slightly different controls on this - as stated by John Clayton , the ViewMasterPage exposes the Ajax/Html/Url helpers and the like, which are not available to the other MasterPages. Other than that, the default controls are slightly

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

大憨熊 提交于 2019-12-02 20:27:45
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? This sounds like a bad idea to start with. The idea of the master is that it shouldn't care what page is there as this is all common code for each page. I use this: string pageName = this.ContentPlaceHolder1.Page.GetType().FullName; It retuns the class name in this format "ASP.default_aspx", but I find that easy to parse for most purposes. Hope that helps! It's better to let the ContentPage notify the MasterPage . That's why the ContentPage has a Master

I'm new to .NET - what should I concentrate on and what should I ignore?

别说谁变了你拦得住时间么 提交于 2019-12-02 15:55:58
So, I've had a fair amount of experience programming database driven web apps using php and coldfusion (not together, at different times) and I'm starting to look into the asp.net world (I have a project coming up at work that is all asp.net/c#.) My question is: there seems to be a lot of stuff to get mired in and if I'm just making web-based applications (mostly CRUD-type stuff - no mind-bending logic) what are the topics I should be focusing on? I just don't want to go down the rabbit trail of something to find out later that it's not really used too much by the development community. In