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: 10/29/2006 7:52:07 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 42 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
kreid
Asp.Net User
Adding CssClass attribute to ContentPlaceHolder10/29/2006 7:52:07 PM

0/0

It seems I can't add a CssClass attribute in the tag of a Content placeholder on my Master Page, eg:

                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" CssClass="myclass">
                    </asp:ContentPlaceHolder>

Why is this the case?

I simply want to keep the style of my content pages abstracted from my master page.  Since adding a css file to a page also applies the styles contained therein to the related Master page, this seemed like the only alternative.
Any ideas what I can do to solve my problem?
 
Thanks,
kreid
 

mbanavige
Asp.Net User
Re: Adding CssClass attribute to ContentPlaceHolder10/29/2006 8:31:16 PM

0/0

the ContentPlaceHolder itself does not actually render so adding a cssclass (if allowed) wouldnt have any effect.
try it like this instead:

<div Class="myclass">
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>
</div>
your page content will appear directly inside of the div

Mike Banavige
~~~~~~~~~~~~
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
kreid
Asp.Net User
Re: Adding CssClass attribute to ContentPlaceHolder10/29/2006 8:54:27 PM

0/0

Ok, I understand.

This won't affect the rendering of the stuff inside the ContentPlaceHolder though, will it? It would be ideal if I used the above div, then inside the placeholder I could just specify <h1>Heading</h1> - rendering the heading with the correct style applied (e.g.: myclass.h1).  I do not think this is possible though, so what is the best way to separate the styles of the masterpage a contentplaceholder page?

The only idea I have is to link to the stylesheets in MasterPage.master and specify classes or ids, e.g.:

.cmaster {font-family: Arial; font-size: 24pt; color: black; }

.content {font-family: Verdana; font-size: 14pt; color: blue; }

 

then in the page:

<h1 class="content">Foo</h1>

etc, etc... 

 

 Anyone got a better way?

 
Thanks,

kreid
 

mbanavige
Asp.Net User
Re: Adding CssClass attribute to ContentPlaceHolder10/29/2006 9:30:18 PM

0/0

kreid:
This won't affect the rendering of the stuff inside the ContentPlaceHolder though, will it?

it certainly could...

kreid:
It would be ideal if I used the above div, then inside the placeholder I could just specify <h1>Heading</h1> - rendering the heading with the correct style applied (e.g.: myclass.h1). 

it would be "myclass h1" which would affect any h1 tag found inside the class myclass. when you use the dot (myclass.h1) you are affecting an h1 contained directly insie the class myclass.


Mike Banavige
~~~~~~~~~~~~
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Learning ASP.NET 3.5 Authors: Jesse Liberty, Dan Hurwitz, Brian MacDonald, Pages: 576, Published: 2008
Professional Community Server Themes Authors: Wyatt Preul, Benjamin Tiedt, Pages: 337, Published: 2007
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Foundations of Microsoft Expression Web: The Basics and Beyond Authors: Cheryl D. Wise, Pages: 370, Published: 2007
Build Your Own ASP.NET 2.0 Web Site Using C# & VB: The Ultimate ASP.NET Begginner's Guide Authors: Cristian Darie, Zak Ruvalcaba, Pages: 689, Published: 2006
Programming Microsoft Web Forms Authors: Douglas J. Reilly, Pages: 303, Published: 2005

Web:
Adding CssClass attribute to ContentPlaceHolder - ASP.NET Forums Re: Adding CssClass attribute to ContentPlaceHolder ... Re: Adding CssClass attribute to ContentPlaceHolder ...
Setting a CssClass or adding an attribute to asp:Content - ASP.NET ... So if you want to set a CssClass or adding an attribute to asp:Content, you can try to do wrap the ContentPlaceHolder with a div control, ...
obj1.sendEvent("load",obj2) not working. p1.ID = "p1"; p1.CssClass = channelCssClass; p1.Attributes. ... CssClass=" moviePlayerContainer"> Craig McMurtry's WebLog : ASP.NET 2.0 #2: Master Pages Mar 4, 2005 ... ...
ASP.NET 2.0: Using the Menu Control ... which provides us with a ContentPlaceHolder control that all pages .... by simply setting the CSSClass attribute to my "toolbar" CSS class defined in ...
Change css class from codebehind C# .net : change, css, class However I cannot figure out how to change the class attribute of a div ...
...
How can i remove the site title from displaying? - SharePoint ... ASP.NET 2.0: A Getting Started Guide [ASP & .NET Tutorials] In most cases, the value you give the CssClass property will be used as the value of the resulting element's class attribute. Let's see an example. ...
Visual studio 2005 HTML design view bugs - .NET ASP asp:contentplaceholder controls in design view. .... "CssClass" attribute so that the text "ApplicationName" is displayed at ...
Feedback: ContentPlaceHolder inside the Head element - special ... I'm running into a similar problem with MasterPages, ContentPlaceHolder and CSS style sheets. If I add a new class to my CSS and reference the CssClass on a ...




Search This Site:










playing mp3 files at .net

asp.net debugging question

more free skins

web service javascript prototype intellisence in vs2008 beta2

register form

package load failure

dropdownlist will not work in content page

control adapters - datalist - headertemplate - checkbox event not firing

help please - difficulties installing ibuyspy

problems when using "publish"

securing exe files with aspnet_isapi.dll

loginstatusadapter requires membershipprovider

treeview bug ! error when try to display non-english characters

smtp & passwordrecovery

membership and profiles

can't connect to database

impersonation...best practice?

sql server yukon cache dependency in page directive

shadow effect in 1.0.10 menu?

contact info for vwd express team members?

start building a module now or wait till v3?

upgraded portal resolves to localhost/dotnetnuke

yaf

mutliple selecting and absolute positioning

problem adding webcontrols to toolbox [reasons can't find]

just wanted to note an excellent isp for dnn 3.0

where is the iewebcontrols.msi file?

trial hosting for asp.net 2.0

render vs render children

web.config issues with password related attributes

 
All Times Are GMT