body.style?

  • Thread starter Thread starter Progman
  • Start date Start date
P

Progman

<body id="body"
style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">

how do i get/set body.style from asp.net?
 
'//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)
 
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

shit...
 
ok found it
<body id="body1" runat="server" >

Me.body1.Attributes("style") =
"background-image:url(../../Pictures/System/CountryMosaic.JPG)"
 
Style is readonly, but you can set this using the attibutes collection

Control.Attributes.Item("style") = " your style attributes "
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top