【问题标题】:How do I a embed a variable css style in a VB.NET xml string literal?如何在 VB.NET xml 字符串文字中嵌入变量 css 样式?
【发布时间】:2010-09-20 20:14:10
【问题描述】:

我想在 HTML 标记内的字符串文字中添加变量数据

Dim locationOfImage as string = "http://blahblah......" 
Dim xmlString = _
            <div style="background:url(" <%= locationOfImage  %> ")">
                <h3>Some text</h3>

            </div>

上面的不行,我不能快速确定怎么做?这可能吗。我可以用 StringBuilder 实现我想要做的事情,但如果可能的话,我想使用 xml 文字。

【问题讨论】:

标签: html css xml vb.net


【解决方案1】:
<div style="<%= String.Format("background:url('{0}')", locationOfImage)  %>">

【讨论】:

    猜你喜欢
    • 2013-07-07
    • 2016-01-15
    • 1970-01-01
    • 1970-01-01
    • 2017-01-29
    • 1970-01-01
    • 2017-12-19
    • 1970-01-01
    相关资源
    最近更新 更多