Reputation: 1541
Is there any control in ASP.NET Web Forms, which is rendered in html tag on page rendering?
Upvotes: 1
Views: 516
Reputation: 952
Similar to Konstantin Zadiran's answer, in the html:
<label id="lblLabel"><asp:Literal runat="server" ID="litLabelText"></asp:Literal></label>
and in the code behind:
litLabelText.Text = ...
Upvotes: 1
Reputation: 16265
You could use a Label
control and the AssociatedControlId
property.
<asp:Label id="lLabel" AssociatedControlId="tbMyField" Text="My field" runat="server" />
<asp:TextBox id="tbMyField" runat="server" Text="My field" />
This will render as
<label for="tbMyField">My field</label>
<input type="tbMyField" name="tbMyField" value="My field" />
Upvotes: 1
Reputation: 1541
It can be done with creating user control which contains property "Text" in code-behind and markup <label><%= Text %></label>
Upvotes: 1