473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Masterpage ContentPlaceHolder within quotes?

I would like to use a ContentPlaceHolder within the following. Any ideas on
how to best accomplish this?
<td rowspan="2" style="width: 600px; background-image:
url('<asp:ContentPlaceHolder ID="ContentPlaceHolderRight" runat="server"
/>'); background-position: bottom right; background-repeat: no-repeat;">

I am thinking that I might have to use a set method off of the masterpage to
set this but I would rather do it declaratively in my content page.

Thanks,

--
Andrew Robinson
http://blog.binaryocean.com

Jun 3 '06 #1
2 1858
I'm having problems of my own with loading content into a ContentPlaceHolder
that is the child of a Panel control. For your problem I would try it this
way...

<td>
<asp:ContentPlaceHolder ID="GenerateImagePlaceHolder" ... />
</td>

Generate your image using application logic in a content page using the
ContentPlaceHolderID.
<!-- HTML from content page -->
<asp:Content ID="GeneratedImage"
ContentPlaceHolderID="GenerateImagePlaceHolder" ...>
<asp:Image ID="ImageGenerated" .... />
</asp:Content>
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"Andrew Robinson" <ne****@nospam.nospam> wrote in message
news:OM**************@TK2MSFTNGP04.phx.gbl...
I would like to use a ContentPlaceHolder within the following. Any ideas on
how to best accomplish this?
<td rowspan="2" style="width: 600px; background-image:
url('<asp:ContentPlaceHolder ID="ContentPlaceHolderRight" runat="server"
/>'); background-position: bottom right; background-repeat: no-repeat;">

I am thinking that I might have to use a set method off of the masterpage
to set this but I would rather do it declaratively in my content page.

Thanks,

--
Andrew Robinson
http://blog.binaryocean.com

Jun 4 '06 #2
Hi Andrew,

Thank you for your post!

Based on my understanding, your questions are as follows:
1) Is it possible to declare a server control in quotes?
2) How to change a background image url on the Master Page from a Content
Page?
If there's anything I've misunderstood, please feel free to post here.

The answer to the first question is No. The "<td" element is client-side,
and only directives such as "<%" or "<%=" are allowed to be included in
quotes.

As for the 2nd question, I think it's more appropriate to define a public
property in the Master Page and set it in the Content Page. For example:

1) Define a public property in the Master Page:

private string _backgroundImageUrl;

public string BackgroundImageUrl
{
get { return _backgroundImageUrl; }
set { _backgroundImageUrl = value; }
}

2) Reference the property in its HTML source:

<table><tr><td
style="background-image:'<%=BackgroundImageUrl%>'"></td></tr></table>

3) In the Content Page's declaration, reference to the Master Page type:

<%@ MasterType VirtualPath="~/MasterPage.master" %>

This will enable strong type reference in the code-behind class of Content
Page.

4) Set the Master Page's property in the Content Page:

protected void Page_Load(object sender, EventArgs e)
{
Master.BackgroundImageUrl = "test1.gif";
}

Hope this helps. If anything is unclear, please feel free to post here.
Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Adam Tibi | last post by:
Hi, I'm using VS 2005. Using multiple MasterPages. When I try to load a page that has a Content pointing to a ContentPlaceHolderID that does not exist in the loading MasterPage an error will...
11
by: simon | last post by:
Hello, I'm helping write a .net app, we are using VS2005 and asp/vb.net for code we are using the "masterPage.master" technique, within the masterpage we have an asp:contentplaceholder that is...
3
by: MRW | last post by:
I have a simple linkbutton and a function when it's clicked. It works perfectly in a regular .aspx page. However, when I place it inside the ContentPlaceHolder, it no longer works. It does...
2
by: Shailesh Patel | last post by:
Hi, I like to target link clicked on one contentplaceholder to another contentplaceholder within one masterpage. Any suggestion? Please let me know. Thank you in advance. Shailesh
6
by: =?Utf-8?B?QmVuIFIu?= | last post by:
Hi, WHen I specify my master page in the page's @Page directive, no problems. However, when I put it ias an attribute in Web.config's page element, the designer fails. It just says "Error...
8
by: Randy Smith | last post by:
Hi, I now need to add MasterPages to a number of existing forms, but when I add the code for MasterPage, the MasterPage does NOT appear when it runs. Any thoughts? TIA, Randy Smith
3
by: Tor Inge Rislaa | last post by:
I have a MasterPage containing a TreeView menu. When clicking a menu item, a page is loaded into the ContentPlaceHolder. It seems like both the MasterPage and the page in the ContentPlaceHolder is...
6
by: Peter Larsen [CPH] | last post by:
Hi, Are there a way to show both ContentPlaceHolser's at the same time ?? The following code show two ContentPlaceHolders, but i don't know what to do to make them both visible at the same time....
0
by: Tommy Jakobsen | last post by:
Hi. Is there a problem when trying to use Javascript on a nested masterpage? On my masterpage, i've got this in the <head>: <asp:ContentPlaceHolder ID="HeadContent" runat="server" /> And on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.