Masterpage Reference Another With The Same Content And Contentplaceholder Tags

Jan 8, 2011

I currently have three masterpages and content pages in the following hierarchy: One root-level masterpage that displays the final result. Call this "A" Two sibling pages that don't reference each other but contain all the same contentplaceholder elements, just in a different order with different <div>'s surrounding them. Both reference the root-level masterpage. Call these "B1" and "B2". Several content pages that reference one or the other sibling master pages above (not both). Call these "C1" through "C-whatever".

Cn => B1 => A
Cm => B2 => A

This hierarchy works fine. Desired Setup What I want to do is add in a new level to this hierarchy (a new master page) between the content pages and the sibling masterpages. Basically so it's like this: One root-level masterpage that displays the final result. Two sibling pages plus a third sibling. Call it B3 A new middle masterpage that dynamically 'chooses' one of the sibling masterpages. The desired behaviour is to pass through the content given by C directly to Bn without modifying it. The only thing D actively does is choose which Bn. Call this new masterpage D. Several content pages that reference the new middle master page instead of the old siblings. The challenge to this is, I'm working within the confines of a rather complex product and I cannot change the original two sibling masterpages (B1 and B2) or content pages (C) in any meaningful way.

I want:

Cn => D => B1 => A
Cm => D => B2 => A
Ck => D => B3 => A

Essentially, D should "pass through" all it's content to whichever B-level masterpage it chooses. I can't put this logic in the C-level pages. Additional Details All B-level pages have the same content/contentplaceholder tags, just ordered and styled differently. D can be as convoluted as it has to be, so long as it doesn't require modifying C or B. I'm using ASP.Net 2.0

View 1 Replies


Similar Messages:

Can Place ContentPlaceHolder Within <script> Tags

Feb 2, 2010

I have this in an ASP.Net Master Page:

<script language="javascript" type="text/javascript">
<asp:ContentPlaceHolder ID="scriptContentHolder" runat="server"></asp:ContentPlaceHolder>
</script>

But when I try to view the content page in design mode it tells me there is an error in the associated Master page because "scriptContentHolder" does not exist.

<asp:Content ID="scriptContent" ContentPlaceHolderID="scriptContentHolder" runat="server">
g_page = "mnuSurveys";
</asp:Content>
<asp:ContentPlaceHolder ID="scriptContentHolder" runat="server"></asp:ContentPlaceHolder>
<asp:Content ID="scriptContent" ContentPlaceHolderID="scriptContentHolder" runat="server">
<script language="javascript" type="text/javascript">
g_page = "mnuSurveys";
</script>
</asp:Content>

View 3 Replies

Web Forms :: Set Treeview Target To A Contentplaceholder In MasterPage

Jun 21, 2010

I have dynamically built my treeview by reading hierarchical data from database, I have divided my MasterPage like so:

<table width="100%">
<tr>
<td style="width:20%">
<asp:TreeView ID="root" Visible="true" runat="server" RootNodeStyle-ForeColor="BlueViolet">
</asp:TreeView>
</td>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
</td>
</tr>
</table>

When I click on one of my treenode, I need to set the node.target to the "ContentPlaceHolder1", ie, keep the tree menu as still and let the content page displayed at the right part of the page. However, the node doesn't seem to recognize the ContentPlaceHolder1.

2. I have tried using <frameset> with 2<frame> pages, this way, the node.target can recognize the frame id, code as below:

<frameset cols="25%, *">
<frame src="menu.aspx" name="Menu"></frame>
<frame src="Main.aspx" name="Content"></frame>
</frameset>

But, I need to check user's login permission, I did it with session("userId") variable and I ran into a problem that the session will only exists on the left frame(menu.aspx), not the content page(Main.aspx). I have tried both methods, but one way or the other, there is some function that I cannot accomplish.

View 1 Replies

Web Forms :: Open Link In Masterpage Contentplaceholder?

May 19, 2010

I have a master page that contains a menu, the menu contains links to pages outside the website, how do get those links to open up in the main contentplaceholder of the master page? I tried setting the target to the ID of the contentplaceholder but that didnt work.

View 2 Replies

Web Forms :: Put Two Different ContentPlaceHolder From Two Different ASPX Page In One MasterPage?

Mar 18, 2010

is it possible to put two different contentPlaceHolder from two different ASPX page in one MasterPage? Just like iFrame? if not what asp.net process/control can?

View 3 Replies

C# - Access Properties From Page In ContentPlaceholder In MasterPage?

Feb 10, 2011

I have following environment:

masterpage with a contentPlacholder multiple pages which use this masterpage and implement a base-class (fooPage) fooPage has a certain property (fooProperty)

[Code]....

Obviously this is not going to work - but how can I achieve this?

I know the alternative: call a method from the masterPage in the contentPage with fooProperty as a parameter - but i would like to rather have a pull-system in this case...

View 2 Replies

Web Forms :: MasterPage Controls Resetting On Postback From ContentPlaceHolder Pages

Nov 18, 2010

Probably a simple fix to this I am not sure. Basically, I have a MasterPage that contains a Dropdownlist. This DDL controls what is displayed in ContentPlaceHolder. However, when postbacks are caused within the Contact Pages the DDL is resetting itself. How can I keep the selected value for the DDL between postbacks?

View 3 Replies

Web Forms :: To Create A Masterpage That Contains A Search Field / How To Display The Result In The Contentplaceholder

Mar 19, 2010

I'm about to create a masterpage that contains a search field, the result from the search should be placed inside a contentplaceholder, but how do I build that? I added the search form to the masterpage (not inside a contentplaceholder), and then I added the eventhandler for the button that trigger the search. Now lest say I want to display the result in the contentplaceholder, how would I do that?

View 4 Replies

AJAX :: Refresh The ContentPlaceHolder , Not The Entire MasterPage When A Link Is Clicked On The TreeView?

May 5, 2010

I have an app that uses masterpages. On the masterPages I have a TreeView. I would like to only refresh the ContentPlaceHolder & not the Entire masterPage when a link is clicked on the treeView.

I have placed the contentplaceholder in an Updatepanel. I would like to if possible avoid including the menu in the update panel.

Using

VS2008 C#

AJAX Control toolkit Version 3.0.30512.20315

View 2 Replies

How To Add Title And Meta Tags For Content Pages In A Project Base On Master And Content Page

Oct 17, 2010

how can i add title and meta tags for content pages in a project base on master and content page(dinamically) ?

i used the blow method for master page :

[code]....

and the error is :(in line *)

Error 17 'System.Web.UI.MasterPage' does not contain a definition for 'SetMetaTags' and no extension method 'SetMetaTags' accepting a first argument of type 'System.Web.UI.MasterPage' could be found (are you missing a using directive or an assembly reference?)

View 3 Replies

Web Forms :: See All The Content Of The Page In The ContentPlaceHolder?

Jan 14, 2010

i copied the html code from an aspx page from the tag <form> all the way down and paste it in the sorce of aspx page that bind with the MasterPage. now on the design view i need to see all the content of the page in the ContentPlaceHolder. it worked for 2 pages but in the thired page as i paste the html code the ContentPlaceHolder didnt reshaped itself to page size in the design its like spred all over the page. i'm working with visual studio 2005 asp.net c#

View 1 Replies

Web Forms :: ContentPlaceHolder On Postback - Doesn't Add Content

Dec 29, 2010

[Code]....

Then, in the codebehind I have this code:

[Code]....

This works fine when I display the page. However, when I click the language link which causes a postback the content block does not get added to the placeholder, so I get a null reference because those two panels don't exist. I've been pulling my hair out over this for a few hours now and I can't figure it out. In case it helps, here is my InitializeCutlture method:

[Code]....

View 13 Replies

MVC :: Determining If There Is Content In A ContentPlaceHolder When Using Html.RenderPartial

Sep 17, 2010

What I'm trying to do is use one master page with two different layouts. Currently we have a "master" master page that has all the common elements and two master pages that use it for the two different layouts. This gives us 3 master pages and there's developer confustion and it is a bit of a hassle to keep them consistent. What I'd like to do instead is say "if there's anything in the MainContent ContentPlaceHolder, show the single column layout, otherwise show the two column layout".

From what I've read you're supposed to be able to do this by using something like the following:

[Code]....

But this.MainContent.Controls.Count retuns zero when the ContentPlaceHolder uses Html.RenderPartial. For example, this works fine:

[Code]....

This causes this.MainContent.Controls.Count to return 1. If I remove MainContent from the view, it returns 0, as expected. However, if I do this:

[Code]....

Then this.MainContent.Controls.Count returns zero.

View 2 Replies

Web Forms :: Ignore Content If ContentPlaceHolder Doesn't Exist?

Mar 24, 2011

I was wondering if there was any way to ignore content if a contentplaceholder doesn't exist?

View 2 Replies

Web Forms :: Creating Content For Each ContentPlaceHolder Of Master Page

Apr 13, 2010

I am searching the internet for possible solution for my problem, I have a page that sets the master page at runtime, my problem is how to create a content (asp:Content) control for each of contentplaceholder (that exists at design-time) in each masterpage?? I am looking at AddContentTemplate, but seems not working...

View 2 Replies

C# - Is It Possible To Read The Content Of A Content Place Holder From The Masterpage

Oct 25, 2010

We would like to use a contentPlaceHolder in our pages to set titles. What we would like to do is have the masterpage check the contentPlaceHolder to see if it has content in it. This way we can set up an e-mailer that will tell us what pages that don't have page titles since we have a fairly large site. We also have nested masterpages.

View 1 Replies

MVC :: How To Show ViewData In Specific ContentPlaceHolder In Specific MasterPage

Feb 1, 2010

This is my Controller Action which takes a Page entity from database and shows it in the Show.aspx view using the "Site.Master" master page:

[Code]....

This is the "Show" view rendering "Page.Title" in the "MainContent" content placeholder:

[Code]....

And this is the "Site.Master"

[Code]....

Using this approach i can show "Page.Title" in Show.aspx using any master page that has a "MainContent" placeholder, but my real goal is if i can when i choose the MasterPage for that particular Page to also see a list of available ContentPlaceHolders and when i choose one to then render "Page.Title" in that particular ContentPlaceHolder.

View 4 Replies

MVC :: Content Not Rendering In Form Tags?

Jun 11, 2010

I'm using a jQuery modal form to gather some information about a user and then redirecting them to another view. However, my submit button will not fire because none of the content is rendering inside the form tags on the generated output.

Here is my code:

[Code]....

[Code]....

[Code]....

View 1 Replies

Web Forms :: Reference To LINK Tag (css) In MasterPage From ContentPage?

Apr 24, 2010

I have applied my stylesheet in my masterpage the following way:

[Code]....

In my contentpage I wish to change the stylesheet of my masterpage, but I'm not sure how to reference to it.

I've tried the following, but I can't scope to the "test".

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
test.Href = "~/CSS/AlternativeMenu";
}
</script>

View 3 Replies

Adding New Meta Tags With Property And Content?

Sep 23, 2010

I programatically add meta tags to the head of each page using htmlhead, specifying the name and content. I now need to add new meta tags with property and content.

View 1 Replies

C# - How To Take The First 100 Characters Of Html Content ( Without Stripping The TAGS )

Mar 29, 2010

There are lots of questions on how to strip html tags, but not many on functions/methods to close them.

Here's the situation. I have a 500 character Message summary ( which includes html tags ), but I only want the first 100 characters. Problem is if I truncate the message, it could be in the middle of an html tag... which messes up stuff.

Assuming the html is something like this:

<div class="bd">"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <br/>
<br/>Some Dates: April 30 - May 2, 2010 <br/>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <em>Duis aute irure dolor in reprehenderit</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <br/>
</p>
For more information about Lorem Ipsum doemdloe, visit: <br/>
<a href="http://www.somesite.com" title="Some Conference">Some text link</a><br/>
</div>

How would I take the first ~100 characters or so? ( Although, ideally that would be the first approximately 100 characters of "CONTENT" ( in between the html tags )

I'm assuming the best way to do this would be a recursive algorithm that keeps track of the html tags and appends any tags that would be truncated, but that may not be the best approach.

My first thoughts are using recursion to count nested tags, and when we reach 100 characters, look for the next "<" and then use recursion to write the closing html tags needed from there.

The reason for doing this is to make a short summary of existing articles without requiring the user to go back and provide summaries for all the articles. I want to keep the html formatting, if possible.

NOTE: ignore that the html isn't totally semantic. This is what I have to deal with from my WYSIWYG.

EDIT:

I added a potential solution ( that seems to work ) I figure others will run into this problem as well. I'm not sure it's the best... and it's probably not totally robust ( in fact, I know it isn't ),

View 4 Replies

Master Page Needs To Know If A ContentPlaceHolder Hasn't Been Used By Current Content Page?

Aug 13, 2010

I have a master page which has several ContentPlaceHolders. Not all of them are used by the current content page all the time. During page rendering the master page needs to set a property when a ContentPlaceHolder wasn't used by the current content page. Meaning a ContentPlaceHolder might not be referenced by the content page.What's the best way for the master page to iterate through its ContentPlaceHolders and find out which ones haven't been used by the current content page? Looking for a solution that does not involve any communication from content page to master page.

View 2 Replies

Using Code Blocks In Head Content And Link Tags?

Feb 1, 2010

I'm building an asp.net app using themes, and I've assigned a theme to the app using the web config.

I have a bookmark icon that I want to use for my page and it is located in the themes directory, but I am having trouble referencing the themes location from a link tag in my header.

First I tried putting a code block inside the link tags href element, which did not work. Instead all it did was html encode the <% characters and output it directly to the browser:

<link rel="shortcut icon" href="/App_Themes/<%=Page.Theme %>/images/bookmark.ico" type="image/x-icon" runat="server"/>

I am able to put a code block inside an element in an hr tag though, so I don't know why it won't work in a link tag:

<hr test="<%=Page.Theme %>"/>

Then I tried doing a Response.Write inside the head tag, but I got an error saying the Controls collection cannot be modified because the control contains code blocks:

<% Response.Write("<link rel="shortcut icon" href="/App_Themes/" + Page.Theme + "/images/bookmark.ico" type="image/x-icon"/>"); %>

I also tried it just with a string literal, and got the same error:

<%= "<link rel="shortcut icon" href="/App_Themes/" + Page.StyleSheetTheme + "/images/bookmark.ico" type="image/x-icon"/>" %>

Is there any way to reference something from the themes directory inside the link tag?

I'm trying to do this in both an ASP.NET 2 and an ASP.NET 2 MVC app.

View 3 Replies

How To Make The Content In Div Tags Invisible On Page Load

Jul 20, 2010

[code]...

I have something like this. I want to make "Package Recap" invisible when the page is loaded. It is in the .

View 1 Replies

C# - Templated Control - Content Is Not Allowed Between The Opening And Closing Tags?

Sep 9, 2010

I'm trying to run the templated user control example provided by MSDN. Code is as follows:

So according to MSDN this should implement as follows:

[code]...

Designer complains that content is not allowed between the opening and closing tags of TemplatedFirstControl and that FirstTemplate is not supported. So what's missing? I duplicated MSDN's code verbatim

MSDN Article: [URL]

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved