CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: Date Entered: 8/5/2007 9:34:32 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 2 Views: 61 Favorited: 0 Favorite
3 Items, 1 Pages 1 |< << Go >> >|
"wreck_of_u" <>
NewsGroup User
Request.Browser: how to change CSS file from server-side script?8/5/2007 9:34:32 AM

0

Ok, I can detect all the browser details with Request.Browser.<whatever>.

One thing I think I may find use for this is for switching style sheets. Say, I have 2 stylesheets, StyleIE7.css and StyleFirefox.css.

If(Request.Browser.Browser.ToString() == "Firefox")

{

    <put code here for the master page to use StyleFirefox.css>;

}

Is this possible? How about using StringBuilder from System.Text class? Thanks

"Amanda Wang -
NewsGroup User
Re: Request.Browser: how to change CSS file from server-side script?8/6/2007 10:33:43 AM

0

Hi,

You can change by changing the theme of the page. create two theme in you website and each contains a css file, one is StyleIE7.css and another is StyleFirefox.css. In the Page_PreInit event check the browser type and change the theme of the page. Then the website will apply the css file under the associate theme folder.

The following is a sample code.
    protected void Page_PreInit(object sender, EventArgs e)
    {
        if (Request.Browser.Browser == "Firefox")
            Page.Theme = "SkinFile";
        else
            Page.Theme = "Basic";
    }

Please let me know if it works.


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
"wreck_of_u" <>
NewsGroup User
Re: Request.Browser: how to change CSS file from server-side script?8/7/2007 2:43:01 AM

0

aha it works :)

but how about my masterpage? will the theme's body{} element override the masterpage's css' body{} element?

 

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


Free Download:













how to access the navigateurl of child of treeview in masterpage to content page?

question re: menu.finditem

accessing base class of page from the masterpage (via code)

treeview context menu

how to call multiview(view) from masterpage

asp.net 2.0 menu interferes with scrolling div

tree view control

problem hiding parent categories using navigation controls

syncronize menu contr/treeview contr/,witmultiview contr w/ navigation sitemappath?

building side nav in a master page

line break within menu control item?

treeview selectednodechanged event

worth using master pages on a static site?

no "select master page" on new item dialog

site menu roles (securitytrimmingenabled) issues

way of dynamically creating the web.sitemap file?

text box on parent master page

how to modify treeview

can master pages be used instead of frame/iframes?

treeview crosspagepostback previouspage on masterpage

how to change user control label that is in master page

sidebar and content area layout problem

null resourcekey

can i use 2 sitemap in a page?

web.config masterpage setting not recognized by vs2005 beta 2

masterpages & meta tags ?

menu control - changing the appearance of the top node to buttons

dynamic site map

problem w/ new asp.net 2.0 menu object over ssl

web.sitemap - roles

problems with a treeview

using relative urls in the menu control

mastepages + php page in the content

'displaydatafrompage' is not a member of 'system.web.ui.masterpage'.

wizard.activestepindex query

treeview takes time to expand for more nodes

login control in master page

sitemappath problems

error image appearance in masterpage

problem with calendar popup in my masterpage:

3 menus with diferent styles for menuitems parents

menu control : cross page posting and posted values in nested controls?

using ddrivetip script with masterpages

treeview; trouble changing other nodes, on selectednodechanged

menu links should be colored diferent

create custom collectionform

cannot edit masterpage content in vs 2008

dynamic controls and masterpage problem

master page navigation troubles

dynamic content within a contentplaceholder

   
  Privacy | Contact Us
All Times Are GMT