从codebehind添加表backgroud [英] adding table backgroud from codebehind

查看:76
本文介绍了从codebehind添加表backgroud的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好朋友。我在一个页面上工作,我需要更改表格的颜色代码,我从数据库中挑选颜色代码。

你能帮帮我怎样才能做到这一点

解决方案

hi,



将表格的HTML代码复制到字符串变量中,然后在表格背景属性上应用你从数据库中检索的颜色。



ex string str =

 <      style   =  background-color: >  <   tr  >  <   td  >  hello <   / td  >  <   / tr  >  <   / table  >  


你必须使用runat =serverID =yourTableID将HTML表转换为服务器端控件。然后在后面的代码中使用以下属性:



 yourTableID.BgColor =   SomeColorFromDatabase; 


good evening friends . i am working on a page where i need to change color code of a table , i am pickiing that color code from database.
Could you please help me how can i do this

解决方案

hi,

Copy the table''s HTML code in a string variable, then on the table background property apply the color you retrieved from database.

ex string str="

<table style="background-color:"><tr><td>hello</td></tr></table>

"


You have to use runat="server" ID = "yourTableID" to convert an HTML table into server side control. Then use the following property in the code behind:

yourTableID.BgColor = "SomeColorFromDatabase";


这篇关于从codebehind添加表backgroud的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆