master-pages

How to highlight active page in a masterpage menu?

旧街凉风 提交于 2019-11-27 06:20:32
问题 I have a menu inside a masterpage (in a ASP.NET Web site), and i want to highlight active page in masterpage menu and submenus. HTML: <ul id="nav" class="sf-menu"> <li class="current-menu-item"><a href="index.html">Home</a></li> <li><a href="page.html">menu-2</a> <ul> <li><a href="page-full.html">full</a></li> <li><a href="page-features.html">featurs</a></li> <li><a href="page-typography.html">typography</a></li> </ul> </li> </ul> CSS: #nav>li.current-menu-item>a, #nav>li.current_page_item>a{

MVC 3: How to render a view without its layout page when loaded via ajax?

时间秒杀一切 提交于 2019-11-27 05:54:04
I am learning about Progressive Enhancement and I have a question about AJAXifying views. In my MVC 3 project I have a layout page, a viewstart page, and two plain views. The viewstart page is in the root of the Views folder and thus applies to all views. It specifies that all views should use _Layout.cshtml for their layout page. The layout page contains two navigation links, one for each view. The links use @Html.ActionLink() to render themselves to the page. Now I have added jQuery and want to hijack these links and use Ajax to load their content on the page dynamically. <script type="text

Parser Error Message: Could not load type 'webmarketing'

╄→尐↘猪︶ㄣ 提交于 2019-11-27 05:35:49
问题 After finishing the web application and publishing it online no matter I try I keep getting the following error, keep in mind that it runs locally as it should... Parser Error Message: Could not load type 'webmarketing'. I ran through that solution though supposedly I'm doing the same as the solution, yet I'm still facing the same issue... ASP.NET Parser Error Cannot load code behind Here is the code behind: using System; using System.Collections.Generic; using System.Linq; using System.Web;

ASP.NET MVC - Set ViewData for masterpage in base controller

守給你的承諾、 提交于 2019-11-27 05:00:15
问题 I'm using a masterpage in my ASP.NET MVC project. This masterpage expects some ViewData to be present, which displays this on every page. If I don't set this ViewData key in my controllers, I get an error that it can't find it. However, I don't want to set the ViewData in every controller (I don't want to say ViewData["foo"] = GetFoo(); in every controller). So, I was thinking of setting this in a base controller, and have every controller inherit from this base controller. In the base

Proper way to use JQuery when using MasterPages in ASP.NET?

♀尐吖头ヾ 提交于 2019-11-27 03:23:50
I have no issues when doing using JQuery in a aspx page without a masterpage, but when I try to use it in pages that have a masterpage, it doesn't work, so I end up putting the jquery files and other script files in the page instead of the master. Now if I have 10 pages, I am doing this for all 10, which I know is incorrect. In the sample masterpage below, where would I put my script files. <html> <head runat="server"> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <asp:ContentPlaceHolder ID="ContentPanel" runat="server"> </asp:ContentPlaceHolder> <

ASP.NET MVC - View with master page, how to set title?

隐身守侯 提交于 2019-11-27 02:44:03
问题 What is prefered way of setting html title (in head) for view when using master pages? One way is by using Page.Title in .aspx file, but that requires in master page which can mess with HTML code. So, lets assume no server side controls, only pure html. Any better ideas? UPDATE: I would like to set title in view NOT in the controller or model. 回答1: In our master pages, we created both an "init" ContentPlaceHolder, and a "title" ContentPlaceHolder. If someone wants to programatically set Page

a page can have only one server-side form tag

醉酒当歌 提交于 2019-11-27 02:15:48
问题 I am using master page and when I run this page, it shows the following error message: a page can have only one server-side form tag How can I solve this problem? 回答1: I think you did like this: <asp:Content ID="Content2" ContentPlaceHolderID="MasterContent" runat="server"> <form id="form1" runat="server"> </form> </asp:Content> The form tag isn't needed. because you already have the same tag in the master page. So you just remove that and it should be working. 回答2: It sounds like you have a

Parser Error: '_Default' is not allowed here because it does not extend class 'System.Web.UI.Page' & MasterType declaration

冷暖自知 提交于 2019-11-27 02:07:35
问题 I recently converted a website project to a web application project in Visual Studio 2008. I finally got it to compile, and the first page (the login screen) displayed as normal, but then when it redirected to the Default.aspx page, I received an error: Parser Error Message: 'SOME.NAMESPACE.MyApplicationName.WebApplication._Default' is not allowed here because it does not extend class 'System.Web.UI.Page'. All of my pages inherit from a class called "BasePage" which extends System.Web.UI.Page

What is the best way to share MasterPages across projects

感情迁移 提交于 2019-11-27 02:06:01
问题 Suppose you have two seperate ASP.NET Web Application projects that both need to use a common MasterPage. What's the best way to share the MasterPage across projects without having to duplicate code? Preferably without having to resort to source control or file system hacks. 回答1: I have trying to accomplish the same thing. I look into a couple of solutions but I think using a virtual directory is probably the best way to share master pages. Here are a couple sources that you can look at.

Form Elements in ASP.NET Master Pages and Content Pages

大城市里の小女人 提交于 2019-11-27 00:51:24
问题 OK, another road bump in my current project. I have never had form elements in both my master and content pages, I tend to have all the forms in the content where relevant. In the current project however, we have a page where they want both. A login form at the top right, and a questions form in the content. Having tried to get this in, I have run in to the issue of ASP.NET moaning about the need for a single form element in a master page. TBH, I really dont get why this is a requirement on