master-pages

What is the best way to share MasterPages across projects

久未见 提交于 2019-11-28 08:09:45
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. JkenshinN 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. Sharing Master Pages amongst Applications by Embedding it in a Dll Sharing Master Pages in Visual

How to pass page's meta tags in ASP.NET MVC?

佐手、 提交于 2019-11-28 07:46:38
I'm playing with ASP.NET MVC for the last few days and was able to build a small site. Everything works great. Now, I need to pass the page's META tags (title, description, keywords, etc.) via the ViewData. (i'm using a master page). How you're dealing with this? Thank you in advance. Here is how I am currently doing it... In the masterpage, I have a content place holder with a default title, description and keywords: <head> <asp:ContentPlaceHolder ID="cphHead" runat="server"> <title>Default Title</title> <meta name="description" content="Default Description" /> <meta name="keywords" content=

jquery mobile needs a refresh to work properly

十年热恋 提交于 2019-11-28 07:04:10
问题 I wrote two pages using master page in .net and JQM. But when I redirect to second page, JQM swipe control does not works without a refresh. Besides, any control or function like a simple alert() does not work. I am sharing my code: Master Page: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="UserMaster.master.cs" Inherits="Password.Masters.UserMaster" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" href=

Calling Content Page Method from MasterPage Method [duplicate]

非 Y 不嫁゛ 提交于 2019-11-28 06:55:51
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: content page class method calling from master page class I need to access Content Page Method from Master page Event. How can I do this? Content Page: public partial class Call_Center_Main : System.Web.UI.Page { Page_Load(object sender, EventArgs e) { } public void MenuClick(string ClkMenu) { // Some Code } } MasterPage: public partial class MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object

Parser Error Message: Could not load type 'webmarketing'

寵の児 提交于 2019-11-28 06:18:25
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; using System.Web.UI; using System.Web.UI.WebControls; namespace webmarketing { public partial class

How to control elements on a asp.net master page from child page

自作多情 提交于 2019-11-28 06:04:07
I have a few pages on my asp.net website that I would like to turn off a control on the master page. Is there a way to communicate with the master page from a child page? Ahmad Mageed Easiest way is to setup a property on your master page that handles the on/off functionality when called. Then in your child page set the MasterType directive to get a strongly typed reference to your master page to bypass the need to cast. Your child page would have: <%@ MasterType VirtualPath="~/Site1.Master" %> And to call the property of the master page: Master.MyLabel = false; // or true So on your master

Form Elements in ASP.NET Master Pages and Content Pages

社会主义新天地 提交于 2019-11-28 04:59:28
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 ASP.NET's part, but hey ho. Does anyone know if/how I can get the master and content pages to contain

“maintainScrollPositionOnPostBack=”true“ ” does not work with google chrome

倖福魔咒の 提交于 2019-11-28 03:40:21
问题 Web.config Level => pages maintainScrollPositionOnPostBack="true" /> Page Level => <%@ Page MaintainScrollPositionOnPostback="true" %> Code Level => Page.MaintainScrollPositionOnPostBack = true; Browser Level => browser id="Chrome" parentID="Safari1Plus"> capabilities> capability name="supportsMaintainScrollPositionOnPostback" value="true" /> capabilities> browser> Any of the 4 ways mentioned above did not work with google chrome . It is working fine with firefox. Kindly provide any solution

ASP.NET masterpages: how to insert markup in the head section inside the aspx?

孤者浪人 提交于 2019-11-28 03:36:32
问题 I know I can access the head section of a page which uses a masterpage programmatically this way (in code behind): This is only an example (I'd like to insert scripts and styles etc.): this.Header.Title = "I just set the page's title"; Is there a simple way to do this in a declarative way on in the aspx file itself ? Sometimes it would be handy to insert a client script or a style declaration or a link to an external resource. 回答1: You can do this by using content regions in the head , in

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

有些话、适合烂在心里 提交于 2019-11-28 02:52:58
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 controller default constructur, I set the ViewData. I found a similar approach here: http://www.asp.net/learn