Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Change Property on Master Page at runtime?

 
Thread Tools Search this Thread
Old 07-07-2006, 03:58 PM   #1
Default Change Property on Master Page at runtime?


Howdy,

I have my master page, and I would like to change the background CSS class
per the content page. Only the home page has a different background style,
all other pages are using the same. I know I can create a new master page,
but I'd like to just change the master page from the content page if
possible.

thanks!

--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com




David Lozzi
  Reply With Quote
Old 07-07-2006, 06:48 PM   #2
=?Utf-8?B?VHVzaGFy?=
 
Posts: n/a
Default RE: Change Property on Master Page at runtime?
Hi David,
Every page has a "Master" property. You can use this property to change the
contents of master page.



"David Lozzi" wrote:

> Howdy,
>
> I have my master page, and I would like to change the background CSS class
> per the content page. Only the home page has a different background style,
> all other pages are using the same. I know I can create a new master page,
> but I'd like to just change the master page from the content page if
> possible.
>
> thanks!
>
> --
> David Lozzi
> dlozzi@(remove)delphi-ts.com
> www.delphi-ts.com
>
>
>



=?Utf-8?B?VHVzaGFy?=
  Reply With Quote
Old 07-07-2006, 08:59 PM   #3
David Lozzi
 
Posts: n/a
Default Re: Change Property on Master Page at runtime?
how to I select the class of the body? Also, would it make sense to check it
from the master page instead of per content page? So put this on the master
page

If content.Page.ToString = "ASP.default_aspx" then
use one background
else
use other
end if

just how do i get to the backjground properties or class name of body??

Thanks!!

David Lozzi

"Tushar" <> wrote in message
news:3961B67C-2AD4-4F81-921D-...
> Hi David,
> Every page has a "Master" property. You can use this property to change
> the
> contents of master page.
>
>
>
> "David Lozzi" wrote:
>
>> Howdy,
>>
>> I have my master page, and I would like to change the background CSS
>> class
>> per the content page. Only the home page has a different background
>> style,
>> all other pages are using the same. I know I can create a new master
>> page,
>> but I'd like to just change the master page from the content page if
>> possible.
>>
>> thanks!
>>
>> --
>> David Lozzi
>> dlozzi@(remove)delphi-ts.com
>> www.delphi-ts.com
>>
>>
>>





David Lozzi
  Reply With Quote
Old 07-07-2006, 09:09 PM   #4
clintonG
 
Posts: n/a
Default Re: Change Property on Master Page at runtime?
To reference properties of the master page from a content page we must type
the master in the content page from which we make the reference...

// in content page
<%@ MasterType VirtualPath="~/Masters/ThreeStackedPanels.master" %>
Then we can use public properties or the FindControl method to reference
properties of a control


// control in Master Page
LinkButton navigation = Master.Page.FindControl("NavigationLinkButton") as
LinkButton;
navigation.CssClass = "SmokeyBlue";
--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/


"David Lozzi" <> wrote in message
news:...
> Howdy,
>
> I have my master page, and I would like to change the background CSS class
> per the content page. Only the home page has a different background style,
> all other pages are using the same. I know I can create a new master page,
> but I'd like to just change the master page from the content page if
> possible.
>
> thanks!
>
> --
> David Lozzi
> dlozzi@(remove)delphi-ts.com
> www.delphi-ts.com
>





clintonG
  Reply With Quote
Old 07-07-2006, 10:16 PM   #5
David Lozzi
 
Posts: n/a
Default Re: Change Property on Master Page at runtime?
got it!
thanks

If cphBody.Page.ToString = "ASP.default_aspx" Then

bdBody.Style("background-image") = "url(site_images/bg_home.gif)"

Else

bdBody.Style("background-image") = "url(site_images/bg_second.gif)"

End If




--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com
"David Lozzi" <> wrote in message
news:ejyTf$...
> how to I select the class of the body? Also, would it make sense to check
> it from the master page instead of per content page? So put this on the
> master page
>
> If content.Page.ToString = "ASP.default_aspx" then
> use one background
> else
> use other
> end if
>
> just how do i get to the backjground properties or class name of body??
>
> Thanks!!
>
> David Lozzi
>
> "Tushar" <> wrote in message
> news:3961B67C-2AD4-4F81-921D-...
>> Hi David,
>> Every page has a "Master" property. You can use this property to change
>> the
>> contents of master page.
>>
>>
>>
>> "David Lozzi" wrote:
>>
>>> Howdy,
>>>
>>> I have my master page, and I would like to change the background CSS
>>> class
>>> per the content page. Only the home page has a different background
>>> style,
>>> all other pages are using the same. I know I can create a new master
>>> page,
>>> but I'd like to just change the master page from the content page if
>>> possible.
>>>
>>> thanks!
>>>
>>> --
>>> David Lozzi
>>> dlozzi@(remove)delphi-ts.com
>>> www.delphi-ts.com
>>>
>>>
>>>

>
>





David Lozzi
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
master page does not change due to preinit event not firing franchise63 General Help Related Topics 0 02-13-2008 09:18 AM
master page & app_theme folder doesn't work dummies2 General Help Related Topics 0 09-04-2007 05:41 PM
Classic Original Broadcasts Trading List - Updated ( w/o/c ) porkys1982@sbcglobal.net DVD Video 0 12-05-2005 03:38 AM
Classic Original Broadcasts Trading List - Updated ( w/o/c ) porkys1982@sbcglobal.net DVD Video 0 11-19-2005 04:46 PM
Original Airings : The A-Team , M*A*S*H , Taxi , Barney Miller , WKRP porkys1982@sbcglobal.net DVD Video 0 08-15-2005 03:09 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46