markzzz
markzzz

Reputation: 47945

if asp:Panel generate a div, what generate a span?

I'd like to know how to insert a span with an asp:Control (not in the cs, but build it in the aspx) instead of a div.

Anyone know?

Upvotes: 2

Views: 827

Answers (2)

Uwe Keim
Uwe Keim

Reputation: 40736

Probably I'm misunderstanding the question; if you want a <span> then why not simply use a <span> tag?

If you want to control it in your code behind, you can add the runat="server" attribute just like for any other control.

E.g.:

<span runat="server" ID="MySpan">Some content</span>

And in your code behind:

private void Page_Load(object sender, EventArgs args )
{
    MySpan.Visible = false;
}

Upvotes: 4

Joel Etherton
Joel Etherton

Reputation: 37533

Typically the asp:Label control uses a span for specific formatting.

Upvotes: 6

Related Questions