简体   繁体   English

如何将多个文本添加到 asp:label 控件?

[英]How to add multiple Text to asp:label control?

I currently have an asp label that has text pull from a string file.我目前有一个从字符串文件中提取文本的 asp 标签。 I want to add a red * next to this label.我想在此标签旁边添加一个红色 *。 How would I go about doing this?我该怎么做呢?

<asp:Label ID="Label29" runat="server" Text="<%$ Resources:strings, sample_generalinformation %>"/> 

You could do the following.您可以执行以下操作。 Just add a span tag to the right of your label tag, with a style attribute with the value of color: red只需在 label 标签的右侧添加一个span标签,其样式属性的值为color: red

Like this:像这样:

 <asp:Label ID="Label29" runat="server" Text="<%$ Resources:strings, sample_generalinformation %>"/><span style="color:red;">*</span>

If you want * along with the same text than this should work:如果你想要*与相同的文本比这应该工作:

<asp:Label ID="Label29" runat="server" Text="<%$ Resources:strings, sample_generalinformation %> <span style='color: red;'>*</span>"/>

Else if you want in seperaret than there is another option of doing it:否则,如果你想要在 seperaret 中,那么还有另一种选择:

 <asp:Label ID="Label29" runat="server" Text="<%$ Resources:strings, sample_generalinformation %>"/><span style="color:red;">*</span> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在asp.net中将文本动态加载到用户控件标签中? - How to dynamically load a text into a user control label in asp.net? asp:label控件可以容纳多少文本有任何限制? - Is there any limit on how much text asp:label control can hold? 如何在ASP.NET中动态添加标签文本的空间 - How to add space for Label text dynamically in asp.net Asp.Net / C#-如何获取在重复器内嵌套的Label控件的文本? - Asp.Net / C# - How to get the Text of a Label control nested inside a Repeater? 如何使用C#将特定asp.net控件(如文本框,标签等),图表控件图像和数据网格中的文本导出到Powerpoint - how to export text in specific asp.net control like textbox,label etc, chart control image and datagrid to powerpoint using c# 如何在C#ASP.NET中使用for循环更改多个asp:标签的文本 - How to change the text of the multiple asp:label using for loop in C# ASP.NET asp.net数据绑定标签控件文本到页面基类的属性 - asp.net databind label control text to property of page baseclass ASP.Net数据绑定到带有文本的标签控件 - ASP.Net data binding to label control with text 从ASP Label Control读取文本(由jquery填充) - Read text from ASP Label Control (populated by jquery) 如何为HeaderTemplate的标签控件设置Text值 - How to set a Text value for a label control of HeaderTemplate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM