Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is their any asp net server control which could render <label> tag?

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>

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 %>. :-(

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

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.

like image 811
Manish Avatar asked Dec 18 '22 04:12

Manish


1 Answers

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" />
like image 146
Stephen Wrighton Avatar answered Jan 31 '23 06:01

Stephen Wrighton