master-pages

Page losing title after UpdatePanel asyncpostback

故事扮演 提交于 2019-12-04 16:41:10
问题 I have just noticed recently that my page title will reset to the standard "Untitled Page" after I perform an asyncpostback from inside my UpdatePanel in the main page. The title will not be lost during a postback from inside the master page (such as when I click on the search box button inside the master page). I assumed that by using a different contentplaceholder specifically for setting the document title I was going to avoid issues like this, but apparently I was wrong. Is there

How to include Javascript file in Asp.Net page

筅森魡賤 提交于 2019-12-04 15:40:30
问题 I want to do some client side validation using javascript in ASP.NET page. I tried using <script src="../../../JS/Registration.js" language="javascript" type="text/javascript" /> but its not working. Please help. 回答1: Probably the file is not in the path specified. '../../../' will move 3 step up to the directory in which the page is located and look for the js file in a folder named JS. Also the language attribute is Deprecated. See Scripts: 18.2.1 The SCRIPT element language = cdata [CI]

CSS not updated during debugging ASP.NET MVC application

放肆的年华 提交于 2019-12-04 15:33:26
问题 I am working on a test application based on ASP.NET MVC. I am new to CSS stuff so I am learning that as well. I have created a master page called "new.master" and created a new css "new.css". I am calling the view from controller as: return View ("About", "new"); What I am doing is that I am frequently updating the css and master page. So I run the application in debug mode frequently. After sometime I stop seeing the effect of changes in css. When I "view source" in chrome and check the css,

ASP.NET MVC displaying user name from a Profile

﹥>﹥吖頭↗ 提交于 2019-12-04 13:30:20
The following is the LogOn user control from a standard default ASP.NET MVC project created by Visual Studio ( LogOnUserControl.ascx ): <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% if (Request.IsAuthenticated) { %> Welcome <b><%: Page.User.Identity.Name %></b>! [ <%: Html.ActionLink("Log Off", "LogOff", "Account") %> ] <% } else { %> [ <%: Html.ActionLink("Log On", "LogOn", "Account")%> ] <% } %> which is inserted into a master page: <div id="logindisplay"> <% Html.RenderPartial("LogOnUserControl"); %> </div> The <%: Page.User.Identity.Name %> code displays the

Can content page use ContentPlaceHolderID of master parent of its master page (nested master pages)

我的梦境 提交于 2019-12-04 12:24:12
I have a 3 level nested master pages and a content page. parent1 is the top parent, parent2 is parent of parent3 and parent3 is the parent of the content page. I get an error ' Cannot find ContentPlaceHolder xxx... ' where xxx is a ContentPlaceholder. It resides in parent2 and content page is trying to fill it. Can content pages only use their direct parent ContentPlaceHolders or can they also use any of the higher master pages? There is one way to do this but there is a slight problem with it under certain circumstances if you are relying on any default content from a placeholder. In your

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

六月ゝ 毕业季﹏ 提交于 2019-12-04 10:53:53
问题 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...? 回答1: 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

HTML inherit page layout

会有一股神秘感。 提交于 2019-12-04 10:14:55
Is it possible to have a regular html page inherit its layout from another html page? If so, what is the most advisable approach for doing this? I know that aspx uses .master pages to hold the elements common to all pages in the site. tekknolagi You could fetch resources using JS and AJAX if you absolutely cannot use a serverside language. how can we avoid header and footer code repeating in each html pages Jekyll works too: What is the best way to manage duplicate code in static HTML websites You could also use get variables and php functions to create and display the content dynamically and

jquery tabs and asp.net master pages issue

陌路散爱 提交于 2019-12-04 09:51:12
i have a website with master pages and content pages. the code for master page is: <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site.master.vb" Inherits="ProjectX1.Site" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> <link href="css/style.css" rel="stylesheet" type="text/css" /> <link href="css/ui-lightness/jquery-ui-1.8.18.custom.css" rel=

Using JQuery in a Subfolder When the MasterPage is in the Root Folder

佐手、 提交于 2019-12-04 08:49:13
I am trying to use the jquery library in ASP.NET in a subfolder called "samples" with a masterpage that is located in the root directory. Presently the references to the jquery scripts are located in the head tag of the master page. If the page I am creating is also in the root directory, everything works fine. If I move the page to the "samples" subdirectory, the jquery breaks. I can fix the problem by using something like the following in the head tag: <script src="<%=ResolveUrl("~/js/jquery.js")%>" type="text/javascript"></script> ...but then I lose the ability to use jquery intellisense,

How to disable specific menu item from menu control in asp.net C# code behind

浪子不回头ぞ 提交于 2019-12-04 08:22:07
In Master Page: <asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" Width="60%" BackColor="#336699" Font-Bold="True" ForeColor="White"> <StaticMenuStyle BackColor="#336699" /> <StaticSelectedStyle BackColor="#336699" /> <StaticMenuItemStyle BackColor="#336699" /> <DynamicHoverStyle BackColor="#336699" /> <DynamicMenuStyle BackColor="#336699" /> <DynamicMenuItemStyle BackColor="#336699" /> <StaticHoverStyle BackColor="#336699" /> <Items> <asp:MenuItem Text="Dashboard" NavigateUrl="~/Timecard/Dashboard.aspx"> </asp:MenuItem> <asp:MenuItem Text="Timecard" NavigateUrl="~/Timecard