将CSS类插入VB中的标签文本中 [英] Insert css classes into label text in VB

查看:141
本文介绍了将CSS类插入VB中的标签文本中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我有一个包含四个链接按钮的网页.单击每个链接按钮将显示来自包含SQL数据库信息的数据集的数据.

我在首页上有四个链接按钮,下面是一个空的div容器.

在后面的代码中,我创建了一个标签控件,在此标签控件中,我将使用"label.text"属性来显示数据集数据.

该标签在for循环中使用.

我的问题是如何将不同的CSS样式应用于标签的不同部分.

例如

第一次通过循环,我希望标签的第一行具有蓝色背景,第二行具有红色背景,等等.

我知道您可以将HTML标记插入Label.text中,例如Label.Text =<< b>你好</b>

 

但是如何插入CSS类标签.我已经尝试过:Label.Text =< span class =" color> Hello</span>

这不起作用.

 

我也尝试过使用Label.innerHtml函数,并将标签添加到页面的div上,例如Div.Controls.Add(Label)

这不起作用

 我尝试使用Label.CssStyles函数,但是每次更改.CssStyle porperty都保持上次读取样式的值时,我无法弄清楚如何更改每一行文本的样式.

我甚至添加了更多标签并将其添加到div中,但是显示的数据集数据始终会产生重复的文件.

解决方案

CSS样式绝不是Visual Basic的一部分,它是完全是ASP.Net演示的一部分.

因此请在论坛中进行尝试

http://forums.asp.net

 


 

Hi,

I have a webpage that has four link buttons. Each link button when clicked will display data from a dataset that holds information from an SQL database.

I have the four link buttons on the top page, below this is an empty div container.

In the code behind i created a label control and in this label control i will be using the 'label.text' attribut in order to display the dataset data.

the label is used within a for loop.

My question is how do you apply different CSS styles to different parts of the label.text

e.g.

The first pass through the loop i want the first line of the label to have a blue background, the second line a red background etc.

I know you can insert html tags into the Label.text e.g. Label.Text = "<b>Hello</b>

 

but how can you insert css class tags. i have tried : Label.Text = "<span class="color">Hello</span>

this does not work.

 

I have also tried using the Label.innerHtml functin and added the label the div on the page e.g Div.Controls.Add(Label)

this did not work

 i tried using the Label.CssStyles function but i cannot figure out how to change the styles for each line of text every time i change the .CssStyle porperty it stays the value of the last read style.

i even added more labels and added them to the div but the dataset data that is displayed always produces duplicate fileds.

any help will do thanks.

解决方案

The CSS style is in no way a part of the Visual Basic part, it is completely a piece of the presentation of ASP.Net.

Try it therefore in a forum for that

http://forums.asp.net

 


这篇关于将CSS类插入VB中的标签文本中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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