master-pages

How to disable/override naming container's ID generation of Content page's control id's

烈酒焚心 提交于 2019-12-05 04:24:53
We have an existing ASP.Net web application which we want to convert into using masterpages. In the process of doing this, I found that the HTML id's generated for the HTML elements are prefixed with the ContentPlaceHolder's id. And this is what can be expected when we set the ContentPlaceHolder's clientidmode=static. Now since we have a lot of existing client side scripts that make use of the id's, this part breaks when we use masterpages, and it is quite a big job to run through all our javascript to make sure we call the javascript using Control.ClientID, as a lot of it is hardcoded. Is

How to change the order of registered scripts in a ScriptManager

為{幸葍}努か 提交于 2019-12-05 03:32:22
Background Within our master page we have a ScriptManager that looks something like this <asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="False" EnableScriptLocalization="true"> <Scripts> <asp:ScriptReference Path="~/js/master.js" /> <asp:ScriptReference Path="~/js/jquery-min.js" /> </Scripts> </asp:ScriptManager> I'm registering additional scripts in nested controls on pages by doing the following protected override void OnPreRender(EventArgs e) { ScriptManager.RegisterClientScriptInclude(this, this.GetType(), "jquery-ui", "~/js/jquery-ui.js"); base.OnPreRender(e);

Pass MasterPage ImageButton event to content Page

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 01:08:12
问题 I have ImageButton in a MasterPage. I want the OnClick event to fire and be captured by the .ASPX page hosted inside the MasterPage? MasterPage: <asp:ImageButton ID="btnClear" OnClick="Clear_Click" ImageUrl="images/Back_Icon_06.png" runat="server" AlternateText="Clear" width="38" height="39"/> 回答1: The masterpage is actually a child of the page (in fact, it's a UserControl). We don't want the page to have to be aware of the intimate details of its child controls (thats why we delegate those

Error: “The file '/MasterPages/MainMaster.master' does not exist.” (Yes, this file does exist!)

爷,独闯天下 提交于 2019-12-05 00:37:08
问题 I just got a new desktop computer with Windows 7 Pro as the operating system. I installed Visual Studio 2008 on to this new computer and tried to open a previously existing ASP.NET 3.5 solution that displayed perfectly fine on my previous computer (this previous computer used the Windows XP operating system, IIS6, and IE7 browser). However, in Windows7/IE8, I’m receiving the following error: Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a

I want a Master UserControl (a Master page, but for UserControls)

两盒软妹~` 提交于 2019-12-05 00:06:17
问题 ASP.NET master pages - essential things. However, I have a lot of very similar UserControls in my projects - it might be a standard layout for an AJAX ModalPopup, or something more involved. I wish I could get rid of some of my duplicated code (both in ascx files and code-behind) with some Master UserControls. Does anyone have any suggestions of a way to achieve this? 回答1: The closest thing I can suggest for what you are looking for is a templated custom control. Unfortunately, sharing

CSS and images on Master Page

谁都会走 提交于 2019-12-05 00:04:03
问题 I have this quite popular problem, but have failed to find a solution that works. Basicly, I am using a Master Page (/Masterpages/Default.master), that includes <link href="../css/style.css" rel="stylesheet" type="text/css /> And it also includes some images with the same relative linking. But when I apply the Master Page to content pages (in diffrent folderlevels) the css formating and images is lost. Is there anyway to dynamicaly solve the folderlevel links to css and images to all content

Remove ctl00$ContentBody$ from rendered control ID

独自空忆成欢 提交于 2019-12-04 23:04:11
问题 I made some changes to an existing application that was previously just straight HTML and Javascript. To add server-side functionality, I chose ASP.NET, and took advantage of the Master Page concept. Unfortunately, on one huge web form, the control IDs are all mangled with the "ctl00$ContentBody$" prefix. I tacked a runat="server" on all the INPUT controls which is what altered the IDs. Now that the IDs have been changed, the Javascript (which is so poorly written I can't even read it, and I

Internet Explorer markup errors when using Google Feed API in master page

☆樱花仙子☆ 提交于 2019-12-04 19:32:17
I'm using Google Feed API to display an RSS-feed on a customers SharePoint intranet, which works perfect with Chrome, Firefox and other modern browsers. The exception is of course Internet Explorer, both 10 and 11 which we've committed to support. The feed is shown only some times, but the errors thrown in the developer console of IE10 or IE11 are always thrown, even when the feed is displayed. I reference the jsapi source as Google suggests, with a regular <script> tag like <script type="text/javascript" src="http://www.google.com/jsapi"></script> The weird behaviour from Internet Explorer

A page can have only one server-side Form tag

喜夏-厌秋 提交于 2019-12-04 18:24:04
i added a page with html code to a master page and i got that mistake when i launched the page. i wonder what i did wrong!??! <%@ Page Title="" Language="C#" MasterPageFile="~/YourGuruMaster.master" AutoEventWireup="true" CodeFile="YourGuru.aspx.cs" Inherits="YourGuru" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <style type="text/css"> .style3 { width: 114px; } .style4 { width: 293px; } .style5 { width: 126px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <form id="form1" runat="server"> <div align=

can someone confirm my understanding about asp.net live cycle?

大城市里の小女人 提交于 2019-12-04 17:01:09
my goal is to find a way to update the title of the page at the very last moment before it get created I have a master page and a content place holder that always contain a page with a specific property. that property can be updated anywhere in the code but I want the final value of that tag to be the html title is the prerender event of that page the best place to set the title? PreRender is one place where you could set the title, another -later- is PreRenderComplete : protected void Page_Init(object sender, EventArgs e) { this.PreRenderComplete += Page_PreRenderComplete; this