Why use asp: HyperLink

In what circumstances is it recommended to use asp: HyperLink control?

I came from an HTML background and create sites with ASP.NET, and I usually use raw HTML by default, while my colleagues use asp: control versions.

In some cases, this makes sense for additional intellisense, for example. upon creation <label>, but for asp: Hyperlink, it seems easier to enter the anchor tag directly.

+5
source share
2 answers

A key advantage is that a hyperlink is a control that can be programmatically manipulated in code.

Aspx

<asp:HyperLink ID="hlLink" runat="server" />

ASPX.CS

hlLink.NavigateUrl = string.Format("~/SomeFolder/SomePage.aspx?SomeKey={0}", someKey);
+9
source

, runat = server, . .

, , , .

, ,

+1

All Articles