473,574 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Masterpage ContentPlaceHol der within quotes?

I would like to use a ContentPlaceHol der within the following. Any ideas on
how to best accomplish this?
<td rowspan="2" style="width: 600px; background-image:
url('<asp:Conte ntPlaceHolder ID="ContentPlac eHolderRight" 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 1870
I'm having problems of my own with loading content into a ContentPlaceHol der
that is the child of a Panel control. For your problem I would try it this
way...

<td>
<asp:ContentPla ceHolder ID="GenerateIma gePlaceHolder" ... />
</td>

Generate your image using application logic in a content page using the
ContentPlaceHol derID.
<!-- HTML from content page -->
<asp:Content ID="GeneratedIm age"
ContentPlaceHol derID="Generate ImagePlaceHolde r" ...>
<asp:Image ID="ImageGenera ted" .... />
</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******** ******@TK2MSFTN GP04.phx.gbl...
I would like to use a ContentPlaceHol der within the following. Any ideas on
how to best accomplish this?
<td rowspan="2" style="width: 600px; background-image:
url('<asp:Conte ntPlaceHolder ID="ContentPlac eHolderRight" 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 _backgroundImag eUrl;

public string BackgroundImage Url
{
get { return _backgroundImag eUrl; }
set { _backgroundImag eUrl = value; }
}

2) Reference the property in its HTML source:

<table><tr><t d
style="backgrou nd-image:'<%=Backg roundImageUrl%> '"></td></tr></table>

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

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

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(objec t sender, EventArgs e)
{
Master.Backgrou ndImageUrl = "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
1339
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 occur specifying that ContentPlaceHolderID doesn't exsit. I want to be able to still load the page even if the MasterPage doesn't contain the...
11
1449
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 the place holder for the main portion of the body of the site my question is, is there a way to test what aspx page will be loaded into the...
3
4065
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 *something*, but certainly not the function, which is also in the ContentPlaceHolder. This is also true concerning any events in there. Any ideas? ...
2
2241
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
6169
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 Creating Control - Content. Content controsl can only be used in a content page." I know that there's an issue w/ nested masters, but I'm only trying to...
8
2087
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
3518
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 refreshed when clicking the menu item. That might be how it is supposed to be, but the problem is that the menu in the masterpage returns to it's...
6
2126
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. <body> <form id="form2" runat="server"> <div style="height:100px;"> Some text
0
1680
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 the nested masterpage: <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> <asp:ContentPlaceHolder ID="NestedHeadContent"...
0
7841
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8100
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8270
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5335
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1099
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.