tags:

views:

45

answers:

1

how can i add text to a legend from code behind

+2  A: 

Assuming you're talking about the HTML Legend Tag and using C# in an ASP.NET site. You can give it an ID and a runat="server" then you can access it from the code behind by name and change its text property.

<form id="form1" runat="server">
<fieldset>
<legend id="myLegend" runat="server">Personalia:</legend>
Name: <input type="text" size="30" /><br />
Email: <input type="text" size="30" /><br />
Date of birth: <input type="text" size="10" />
</fieldset>
</form>

Then in the code behind:

myLegend.InnerText = "Foo";
Brendan Enrick