CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 9/17/2007 9:54:43 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
lbriner
Asp.Net User
Master Page default content not being overridden9/17/2007 9:54:43 AM

0/0

I have a web form which inherits a master page with various content placeholders. The problem I have is if I put default content in the master page then this content is being displayed even when I override it in a content page.

 Master Page (excerpt):

 <asp:ContentPlaceHolder ID="rightImages" runat="server">
<img src="<%=ResolveClientUrl("~/images/image_top1.jpg")%>" alt="Front room interior" class="imageblock" />
<img src="<%=ResolveClientUrl("~/images/image_mid1.jpg")%>" alt="Lifestyle shot" class="imageblock" />
<img src="<%=ResolveClientUrl("~/images/image_btm1.jpg")%>" alt="Exterior of a house" class="imageblock" />
</asp:ContentPlaceHolder

 Web form:

 

<asp:Content ID="Content7" ContentPlaceHolderID="rightImages" Runat="Server">
<img src="<%=ResolveClientUrl("~/images/image_top2.jpg")%>" alt="Front room interior" class="imageblock" />
<img src="<%=ResolveClientUrl("~/images/image_mid2.jpg")%>" alt="Lifestyle shot" class="imageblock" />
<img src="<%=ResolveClientUrl("~/images/image_btm2.jpg")%>" alt="Exterior of a house" class="imageblock" />
</asp:Content>
  

The only way to see the images in the web form is to comment out the default content in the master page. I must be doing something badly wrong because I couldn't find anyone else on Google who has reported the same problem.

Can anyone please help?

TIA Luke 


Senior Software Developer

*Please mark the thread as Resolved if this answers your question*
v_sreedhar@hotm
Asp.Net User
Re: Master Page default content not being overridden9/17/2007 7:01:10 PM

0/0

 

It is weird error! I tried to fix it but never worked ... the only solution is by using asp:Image in the master page ...

<asp:Image ID="Image1" runat="server" ImageUrl="~/images/image_top1.jpg" AlternateText="Front room interior" />

 It works ...

In case, you find it fixed, mark it as fixed.

Amanda Wang - M
Asp.Net User
Re: Master Page default content not being overridden9/19/2007 3:08:06 AM

0/0

Hi,

"~" represents the root directory of the application, is the absolute path,  is only used for the server control.

But the img control that you used in the application is a html control. So if you want to use the "~" in the path, you should add "runat=server" property, or you use the related path(for example: ../../).

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
v_sreedhar@hotm
Asp.Net User
Re: Master Page default content not being overridden9/20/2007 8:25:37 PM

0/0

We never add for ResolveClientUrl ... runat=server for other controls. Why only for IMG?

You can test the same code with using DIV, it shows perfectly. But not for IMG tag? Even with your approach also .. by adding runat=server also to IMG ... it doesn't work weird problem ... 

Question (rephrased):
   When DIV tag + ResolveClientURL is used in Master Page and derived page has overriden content, the content is overriden.
   But if you do the same with IMG tag + ResolveClientURL, the default content is not overriden.

 

 

4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Mastering InDesign CS3 for Print Design and Production: for print design and production Authors: Pariah S. Burke, Pages: 492, Published: 2007
Microsoft Sharepoint: Building Office 2007 Solutions in C# 2005 Authors: Scot Hillier, Pages: 513, Published: 2007
ASP.NET 2.0 MVP Hacks and Tips Authors: David Yack, Joe Mayo, Scott Hanselman, Fredrik Normén, Dan Wahlin, J. Ambrose Little, Jonathan Goodyear, Pages: 400, Published: 2006
Professional Community Server Themes Authors: Wyatt Preul, Benjamin Tiedt, Pages: 337, Published: 2007
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
Beginning ASP.NET 2.0 E-commerce in C# 2005: From Novice to Professional Authors: Cristian Darie, Karli Watson, Pages: 681, Published: 2005
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008

Web:
Master Pages :: Multiple ContentPlaceHolders and Default Content ... ContentPlaceHolder's default content. By doing so, we only need to override this default. content in those few pages that do not display the username and ...
ASP.NET QuickStart Tutorials Individual content pages in the site inherit the common site layout and look-and -feel from the Master Page, but override the default content for the named ...
Creating a Layout Using Master Pages A ContentPlaceHolder can also contain default content, just in case the derive page does not need to override this content. ...
WorldofASP.NET: Working with Master Pages and Basics of Master ... Aug 23, 2007 ...

Default content that will render if not overridden on the content page! ...
Master pages - Spring.NET - Confluence It can also include default content within the placeholder that will be displayed if page does not override specific placeholder. Page that uses this master ...
Wrox Article : Using ASP.NET Master Pages for Consistent Site ... If, however, he decides not to set it on the content page for whatever reason, the default content from the Master Page will show up instead. ...
Master Pages in ASP.NET 2.0 ... default content that will render only if not overridden on the content page! ... Once you have your master page, you obviously want to create content ...
Modify the default SharePoint content placeholders - SharePoint ... Alternatively, you can override any of the default content placeholders on a .... Note You can make changes to all of the content on a master page, not just ...
CodeGuru: Using ASP.NET Master Pages for Consistent Site Design Sep 17, 2008 ... You know, the default content you set in the Master Page for ContentPlaceHolder2 . It's not there! Does that mean there is an error in this ...
Master Pages in ASP.NET 2.0 (Part 1) / General / ASP. NET ... ... is the default content. It shows up when there is no content to override this content. ... NET which master page is being used for this content page. ...





Search This Site:










datalist select button

what kind of payment processing can be installed in ibuyspy?

changing a divs class on master page? please help..

databases totally confused

how do i change data providers inside a module?

loop insertion

compiling dll files

msn money charts in vs.net

proximity maps?

unicode string display

error on events & node index select

api call to get userid

server uptime

cant compile website

basic email code

splitting a string

treeview style

confusion

app will not recognize connection

'exclude files from web project' - beta 2

include it twice

inheriting from portalmodulecontrol

frames in contentplaceholder controls

sending automatic 30 day reminder emails from vb.net and access database

batabase question

error accessing vs2005 site over a network

adding a field to the news_edit page

resources problem with wap

ajax control toolkit problem

properties refresh

 
All Times Are GMT