| |

VerySource

 Forgot password?
 Register
Search
View: 935|Reply: 6

How to get the background color value of the page in asp.net

[Copy link]

4

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-12-17 02:00:01
| Show all posts |Read mode
How to get the background color value of the page to a variable in the server program in asp.net (you can use javascript, but it cannot be passed to the server-side program)
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-12-17 12:00:01
| Show all posts
<BODY MS_POSITIONING="GridLayout" bgcolor="red" id="body" runat="server">

Declare in the background:

protected System.Web.UI.HtmlControls.HtmlGenericControl body;

then:

Response.Write(body.Attributes["bgcolor"]);
Reply

Use magic Report

0

Threads

60

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-12-17 15:00:01
| Show all posts
You can get it with JS, set a hidden server control, give the value to the server control, the server can get it
Reply

Use magic Report

4

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-12-19 00:00:01
| Show all posts
Is there an easy way
Reply

Use magic Report

0

Threads

21

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-12-19 10:30:01
| Show all posts
<body id="body" runat="server" style="background:#eee;">

Response.Write(body.style("background"))
Reply

Use magic Report

4

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-12-19 23:30:01
| Show all posts
can
If it is written in bgcolor, it seems not to work
Reply

Use magic Report

0

Threads

21

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-12-20 16:30:01
| Show all posts
bgcolor is not a recommended standard for xhtml. It is already an obsolete markup.
If you write bgcolor="#eeeeee", then the method I used before will not work.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list