Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > body.style?

Reply
Thread Tools

body.style?

 
 
Progman
Guest
Posts: n/a
 
      03-04-2006
<body id="body"
style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">

how do i get/set body.style from asp.net?


 
Reply With Quote
 
 
 
 
Terry Burns
Guest
Posts: n/a
 
      03-04-2006
'//You need to set the Runat attribute to server and give it an ID.
<body id="body" runat=server style="MARGIN-LEFT: 20px" vLink="#0000ff">

'//Declare the variable In the designer section
Protected body As System.Web.UI.HtmlControls.HtmlGenericControl

'//In your page load event ( or wherever ) use it
Response.Write(body.Attributes("style").ToString)

--
Terry Burns
http://TrainingOn.net



"Progman" <> wrote in message
news:l7lOf.29447$W%...
> <body id="body"
> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
>
> how do i get/set body.style from asp.net?
>



 
Reply With Quote
 
 
 
 
Progman
Guest
Posts: n/a
 
      03-04-2006
I tried thi`s:
<body id="body" runat="server"

then you will be able to this
body.style = "background-Image...."

but the compiler says, style is read-only

****...


"Progman" <> wrote in message
news:l7lOf.29447$W%...
> <body id="body"
> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
>
> how do i get/set body.style from asp.net?
>



 
Reply With Quote
 
Progman
Guest
Posts: n/a
 
      03-04-2006
i need to set the style attribute.
will this do it?

"Terry Burns" <> wrote in message
news:...
> '//You need to set the Runat attribute to server and give it an ID.
> <body id="body" runat=server style="MARGIN-LEFT: 20px" vLink="#0000ff">
>
> '//Declare the variable In the designer section
> Protected body As System.Web.UI.HtmlControls.HtmlGenericControl
>
> '//In your page load event ( or wherever ) use it
> Response.Write(body.Attributes("style").ToString)
>
> --
> Terry Burns
> http://TrainingOn.net
>
>
>
> "Progman" <> wrote in message
> news:l7lOf.29447$W%...
>> <body id="body"
>> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
>>
>> how do i get/set body.style from asp.net?
>>

>
>



 
Reply With Quote
 
Progman
Guest
Posts: n/a
 
      03-04-2006
ok found it
<body id="body1" runat="server" >

Me.body1.Attributes("style") =
"background-image:url(../../Pictures/System/CountryMosaic.JPG)"

"Progman" <> wrote in message
news:a3mOf.29592$W%...
>i need to set the style attribute.
> will this do it?
>
> "Terry Burns" <> wrote in message
> news:...
>> '//You need to set the Runat attribute to server and give it an ID.
>> <body id="body" runat=server style="MARGIN-LEFT: 20px" vLink="#0000ff">
>>
>> '//Declare the variable In the designer section
>> Protected body As System.Web.UI.HtmlControls.HtmlGenericControl
>>
>> '//In your page load event ( or wherever ) use it
>> Response.Write(body.Attributes("style").ToString)
>>
>> --
>> Terry Burns
>> http://TrainingOn.net
>>
>>
>>
>> "Progman" <> wrote in message
>> news:l7lOf.29447$W%...
>>> <body id="body"
>>> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
>>>
>>> how do i get/set body.style from asp.net?
>>>

>>
>>

>
>



 
Reply With Quote
 
Terry Burns
Guest
Posts: n/a
 
      03-04-2006
Style is readonly, but you can set this using the attibutes collection

Control.Attributes.Item("style") = " your style attributes "
--
Terry Burns
http://TrainingOn.net




"Progman" <> wrote in message
news:7KlOf.29586$W%...
>I tried thi`s:
> <body id="body" runat="server"
>
> then you will be able to this
> body.style = "background-Image...."
>
> but the compiler says, style is read-only
>
> ****...
>
>
> "Progman" <> wrote in message
> news:l7lOf.29447$W%...
>> <body id="body"
>> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
>>
>> how do i get/set body.style from asp.net?
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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




Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57