master-pages

Cache Master Page in ASP.NET

一笑奈何 提交于 2019-12-05 21:53:37
How can I cache the master page in ASP.NET? Unlike user controls, you can't OutputCache a Master page by itself--only as part of a Page. Also, OutputCaching won't help the performance of a toolbar with lots of images anyway. The kind of things that would help include image sprites, client-side caching, using a CDN, using multiple domains for static files, etc. In case it's helpful, I cover those strategies in my book: Ultra-Fast ASP.NET . If you use the @OutputCache directive on the page that uses the master page, then the master page will be cached along with the rest of the page. 来源: https:/

how to change title of aspx page dynamically on page load

和自甴很熟 提交于 2019-12-05 19:25:41
问题 I had set of ASPX pages in which each page had different titles, but I want to put default title for pages which don't have a title. The default title must be configurable. 回答1: If this is classic ASP.NET (not MVC) and you are using MasterPage then you can set default title in Page_Load event in MasterPage : protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Page.Title)) { Page.Title = ConfigurationManager.AppSettings["DefaultTitle"]; //title saved in web.config }

Why doesn't my jQuery UI datepicker work for postbacks when it works fine on initial page loads?

吃可爱长大的小学妹 提交于 2019-12-05 18:53:48
I've been trying to integrate the jQuery UI Datepicker into our ASP.NET WebForms application. The application uses master pages to provide a common look to all pages, and all of the content pages are built inside the ContentTemplate of an UpdatePanel. I've created a user control to wrap the datepicker's functionality and allow setting of the minDate, maxDate, validators, etc. for each date from the codebehind at runtime. I also need to deal with the way ASP.NET generates client element IDs. Over the last week, I've searched high and low, and found lots of tips for getting it to work. Here is a

Can I Include different javascript/css files per Content Page using ASP.NET WebForms Master Pages?

青春壹個敷衍的年華 提交于 2019-12-05 16:52:09
I have several Content Pages using the same Master Page, that don't all need the same javascript and css files included in the <head> tag. Is it possible to change the contents of the <head> tag from the Content Pages? it is, but I recommend doing it a bit different. I place a content place holder right above the close body tag. Then I populate the required JS scripts per content page. This will allow you to place the scripts at the bottom, but you could also do the same with the placeholder in the header. You can also do so programmatically: HtmlGenericControl js = new HtmlGenericControl(

ASP.NET MVC Master Page Data

a 夏天 提交于 2019-12-05 16:33:55
The more I use ASP.NET MVC, the more I love it. However, in the case of showing model data on master pages there seems several ways of doing it. I am unsure as to the best solution. My example would be a commerce site where I want to output a list of product categories on every page and also show the status of the visitors cart. In asp.net web forms I would typically do this using user controls each doing their own databinding to retrieve the required data. In MVC all data should be passed by the controller. So regarding the categories the simplest solution would seem to be to pass this in

How to dynamically change master page's master page?

▼魔方 西西 提交于 2019-12-05 15:06:53
I am trying to change the master page dynamically, and although it's easy to do from a content page (overriding OnPreInit ), there is no such event for a master page. Is it possible to introduce this event somehow? UPDATE: I got halfway there by going via the PreInit of the pages at the bottom of the ladder, turns out you can do things like base.Master.MasterPageFile = "/master.Master"; , but for some reason this doesn't load the stuff in the header of the top-most master page, namely stylesheets. Kamyar Quoting from: Can I change a nested master page's master dynamically? Just tested this and

How to use the site's masterpage from a _layout SharePoint page?

♀尐吖头ヾ 提交于 2019-12-05 14:39:24
I want to use a masterpagefile (the site's one if this makes sense) in my SharePoint 12 hive/template/layouts/TelephoneBookList/test.aspx file. However, whenever I add MasterPageFile="~/_layouts/simple.master" or something like that to my test.aspx page, I get a sharepoint error page and the following in the log file: 01/12/2009 10:56:26.95 w3wp.exe (0x1064) 0x1280 Windows SharePoint Services Topology 0 Critical Invalid URL: http://localhost . You may also need to update any alternate access mappings referring to http://mcdevsp . Help on this error: http://go.microsoft.com/fwlink/?LinkId

Why master page doesn't have PreInit event in ASP.NET?

邮差的信 提交于 2019-12-05 09:23:35
The following is the sequence in which events occur when a master page is merged with a content page: Content page PreInit event. Master page controls Init event. Content controls Init event. Master page Init event. Content page Init event. Content page Load event. Master page Load event. Master page controls Load event. Content page controls Load event. Content page PreRender event. Master page PreRender event. Master page controls PreRender event. Content page controls PreRender event. Master page controls Unload event. Content page controls Unload event. Master page Unload event. Content

Only Content Controls are Allowed (C# webcontrols)

江枫思渺然 提交于 2019-12-05 05:54:38
So, I'm not sure what's going on. My boss wasn't pleased with me using MVC and Razor, so I'm being forced to code with this nasty webcontrol/codebehind style. =/ The error is: Only Content controls are allowed directly in a content page that contains Content controls. Here is the masterpage: <%@ Master Language="C#"%> <!DOCTYPE html> <html> <head> <title>Application Form</title> </head> <body> <div id="container"> <asp:contentplaceholder id="contentPlaceHolder" runat="server" /> </div> </body> </html> And here is the Default.aspx page that's throwing the error. <%@ Page Language="C#" Inherits=

Stop Master page refreshing while navigating between pages?

a 夏天 提交于 2019-12-05 05:07:14
I'm using Master Page in my ASP.net application, in the master page I put a ContentPlaceHolder in Update Panel to support AJAX in child pages, the question is how to stop Refreshing "master page controls" while navigating between pages? For navigation between pages I tried to use Response.Redirect , windows.location java script with no success, shall I use the Frames or IFrames instead of Master Pages to stop Refreshing? any suggestion to solve this issue will be highly appreciated, Thanks in advance... If you don't want the page to refresh when switching between "pages", you will not have any