master-pages

Html.RenderPartial call from masterpage

谁都会走 提交于 2019-12-21 12:01:15
问题 Here is a scenario: Let's say I have site with two controllers responsible for displaying different type of content - Pages and Articles. I need to embed Partial View into my masterpage that will list pages and articles filtered with some criteria, and be displayed on each page. I cannot set Model on my masterpage (am I right?). How do I solve this task using Html.RenderPartial? [EDIT] Yes, I'd probably create separate partial views for listing articles and pages, but still, there is a

Access Master Page public method from user control/class/page

↘锁芯ラ 提交于 2019-12-21 04:40:55
问题 I am to access a method on my master page. I have an error label which I want to update based on error messages I get from my site. public string ErrorText { get { return this.infoLabel.Text; } set { this.infoLabel.Text = value; } } How can I access this from my user control or classes that I set up? 回答1: Page should contain next markup: <%@ MasterType VirtualPath="~/Site.master" %> then Page.Master will have not a type of MasterPage but your master page's type, i.e.: public partial class

How should I integrate session state into an ASP.NET MVC application?

半腔热情 提交于 2019-12-21 04:30:23
问题 I'm looking for thoughts on how should I use Session in an ASP.NET MVC application? Especially when using masterpages and tryin to just get the data to the masterpage without bypassing the controller. This question started off by me asking a lot of little questions, but then I managed to mould it into a solution which as yet I have not implemented but one which is somewhat workable. Would appreciate any feedback. My proposed solution aka 'what i am about to implement unless someone says stop!

How to set Page's Title from a web content page in ASP.NET 3.5

孤街醉人 提交于 2019-12-21 04:25:10
问题 I've read through quite a bit of posts/articles on how to do this and I still am not getting the page title set from the content page. My pages render OK except I can't get the title set from the content page (all the page's have Title set as per the master page). Here's the codebehind for my master page: Partial Class zSEO Inherits System.Web.UI.MasterPage Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Page.Header.Title = "Dynamically set in Master page" End Sub

How to determine which Child Page is being displayed from Master Page?

若如初见. 提交于 2019-12-20 09:50:48
问题 I'm writing code on the master page, and I need to know which child (content) page is being displayed. How can I do this programmatically? 回答1: This sounds like a bad idea to start with. The idea of the master is that it shouldn't care what page is there as this is all common code for each page. 回答2: I use this: string pageName = this.ContentPlaceHolder1.Page.GetType().FullName; It retuns the class name in this format "ASP.default_aspx", but I find that easy to parse for most purposes. Hope

Need workaround for .Net Master Page Name Mangling

让人想犯罪 __ 提交于 2019-12-20 01:01:56
问题 I'm evaluating converting an old frameset based asp.net website to use master pages. The only thing holding me back is the huge amount of work it will take to update every page to deal with name mangling. Most of my problems are with javascript referencing hardcoded Id's. Is there a way for me to tell ASP.Net that for a particular content area that I don't want mangling to occur. Leave it to me deal with name conflicts. Note I'm aware .Net 4.0 has a solution for this as detailed here. I want

A page can have only one server-side Form tag.

耗尽温柔 提交于 2019-12-19 10:21:35
问题 Masterpage.aspx <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'> </script> <script src="Chrome.js" type="text/javascript"></script> </head> <body> <form id="Master" runat="server"> <table style="width:987px; margin:auto; height: 86px;"> <tr style="background-color:#FFFFFF"> <td class="style2"> <img src=

How do I use Paul Irish's Conditional comments in a SharePoint 2010 master page

我只是一个虾纸丫 提交于 2019-12-19 08:06:14
问题 I want to use Paul Irish's Conditional comments from the Boilerplate HTML template: <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]--> <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]--> <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]--> <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> in a SharePoint 2010 masterpage. I have read 'conditional comments don’t

How do I use Paul Irish's Conditional comments in a SharePoint 2010 master page

岁酱吖の 提交于 2019-12-19 08:06:02
问题 I want to use Paul Irish's Conditional comments from the Boilerplate HTML template: <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]--> <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]--> <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]--> <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> in a SharePoint 2010 masterpage. I have read 'conditional comments don’t

Ways to stick footer to the bottom a page

瘦欲@ 提交于 2019-12-19 04:07:12
问题 I followed the How do you get the footer to stay at the bottom of a Web page? post on stackoverflow... But i couldn't make it too work in an asp.net web application.... I am using a master page for all pages... How can i make footer stick to the bottom of the page? For ref: <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td> <table width="100%" cellpadding="0" cellspacing="0" class="bgpatt"> <tr style="height:25px;"> <td style="width:40%"> </td> <td style="width:30%"> </td> <td