简体   繁体   中英

how to Change style dynamically in aspx page

How to write below code with <%=%> sign . Here Background color is coming from service and I have to put this in server variable like below code . But its giving warning and not working properly . Please help

style="background-color:<%=servicecall.color%>"

You have to make the service call, before the page is rendered in the asp.net view engine and server send it back to the client. That being said, I would make the call in my serve side code, I would store the result in a variable of the corresponding page class and I would bind this value to the background-color, like

 style="background-color:<%=color%>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM