如何从datalistView中的字段填充div? [英] How to fill div from field in datalistView?
本文介绍了如何从datalistView中的字段填充div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.
我有一个大问题,所以让我生气.
我的数据库中有一个带有字段的表.字段值是十六进制颜色,例如:
#FF00FF.我创建一个datalistView并将其绑定.我通过三种方式来填充div:
1.在div中使用样式:
Hi anyone.
I have a big problem and so make me angry.
I have a table in my database with field. The fields value is a hex color Like:
#FF00FF. I create a datalistView and binding it. In three way i come to fill a div:
1. Use Style in div:
style="background-Color=<%# Eval("fieldColor") %>"
不行:(
2.从面板使用并绑定BackColor属性:
It''s not work. :(
2. Use from panel and binding BackColor property:
<asp:Panel ID="Panel1" Width="25px" Height="25px" BackColor=''<%# Eval("fieldColor") %>'' BorderStyle="Dashed" BorderColor=''<%# Eval("cBorder") %>'' runat="server">
它也不行. :((
经过大量搜索后,我找到了以下代码:
3.使用转换器:
It''s not work too. :((
After a lot of searching i find this code:
3. Use Converters:
>BackColor=''<%# System.Drawing.ColorTranslator.FromHtml("Eval(''cFi ll'')") %>''
不好了.它不再起作用. :mad:
感谢您的帮助.
Oh no. It''s not work again. :mad:
Thanks for your help.
推荐答案
使用
<div style="background-color:<%# Eval("color") %>">
不是background-color=
,而是background-color:
注意:不要说紧急情况.这里的任何人都不是紧急情况.没有人被迫在这里为您提供帮助.所以要保持礼貌.
Use
<div style="background-color:<%# Eval("color") %>">
Notbackground-color=
butbackground-color:
Note: Don''t say emergency. It is not emergency for any one here. Nobody is compelled to help you here. So try to be polite.
哦,哦.打扰一下.我在语言上犯了错误.我不是英国人.我知道,但我只是想让你知道,这是我的语言不好.我不客气.对我来说很紧急. :((
感谢您的帮助.我必须用我的语言进行工作和练习.
oh oh. excuse me. i make mistake in language. Im not a English person. i know that but just i want u know, it''s from my bad language. I am not polite. It''s emergency for me. :((
Thanks from your help. I have to work and practice in my language.
这篇关于如何从datalistView中的字段填充div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文