Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Styling with master page results in bad rendering 1

Status
Not open for further replies.

collegian

Programmer
Jul 1, 2010
64
US
Hello,

I am applying master page to my .aspx pages but the pages are not being rendered well. However, when I do not use the master page and apply css to style the page it renders well.
Can anyone give some suggestion as to what might be causing the issue with master page?

Also,is there any way to apply additional styles to a .aspx page in addition to the master page,without using inline css?
 
To answer your second question...yes you can apply additional styles to a page without inline CSS. You can dynamically insert a new stylesheet reference in the PreReder method of your page (or Load, Init, whereever).

Check this out
Code:
 Dim mainStylesheet As New HtmlLink
            mainStylesheet.Attributes.Add("type", "text/css")
            mainStylesheet.Attributes.Add("rel", "stylesheet")
mainStylesheet.Attributes.Add("href", ResolveUrl("~/StyleSheets/YUI.Green.css"))

 Me.Header.Controls.Add(entry)

Above the Me.Header is the name of the <head> element of the masterpage (you might need to get a reference to this from your content page if neccessary). I do this so that users can set preferences of how the site looks (different stylesheet for different users).

Regards,

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top