他们的任何asp网络服务器控件可以呈现< label>标签? [英] Is their any asp net server control which could render <label> tag?

查看:111
本文介绍了他们的任何asp网络服务器控件可以呈现< label>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想呈现< label> 标记。但是想要设置它的一些属性,而它的渲染像文本值。

I want to render a <label> tag. But want to set some of it's properties while it's rendering like for and text value.

其实我真正的问题是我想将一个标签与一个单选按钮相关联,并且这是迄今为止的代码:

Actually my real problem is I want to associate a label with a radio button and this is the code so far I have:

<asp:RadioButton ID="Option4" GroupName="A" runat="server" />

<label for='<%=Option4.ClientID %>' id="lblOption4" runat="server">4</label>

但是这个代码的问题在于它不能正常工作,并且为这是因为它的值<即= Option4.ClientID%>。 : - (

But the problem with this code is that it is not working and rendering the for attibute's value as it is i.e. <%=Option4.ClientID %>. :-(

他们的任何asp网络服务器控件会呈现标记吗?

Is their any asp net server control which would render tag?

我不想要设置单选按钮的Text属性由于一些CSS限制,所以PLZ不会给出答案,为什么不设置单选按钮的Text属性。

I don't want to set the Text property of the radio button due to some CSS limitations so plz do not give answers like why don't you set the Text property of the radio button.

推荐答案

如果这是.NET 2.0或更高版本,则使用ASP.NET LABEL控件。

if this is .NET 2.0 or later, then use the ASP.NET LABEL control.

<asp:RadioButton ID="Option4" GroupName="A" runat="server" />
<asp:Label AssociatedControlId="Option4" Text="4" runat="server" />

这篇关于他们的任何asp网络服务器控件可以呈现&lt; label&gt;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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