Denis
Denis

Reputation: 3747

`a` tag with runat server and tilde in href

For example, I have two sibling pages Index.aspx and Orders.aspx in one folder. On the page Index.aspx I have the link to Orders.aspx. What is the correct way to implement this:

<a runat="server" href="~/Orders.aspx">

or

<a href="Orders.aspx">

I know what runat="server" does (server-control, performance impact etc.).

Upvotes: 0

Views: 645

Answers (2)

prospector
prospector

Reputation: 3469

You really never need to run markup with a run at server tag if it's never used in code behind, if it is then you should use a ASP.NET control for it.

So just a hyperlink without runat=server would be fine.

It's always best to use ASP.NET controls on your page though if an upgrade in the future could require language translations, or have some logic assigned to them in the future. So always plan ahead on your designs.

Upvotes: 1

Alexander Dayan
Alexander Dayan

Reputation: 2924

If both views are in the same folder, than the second one:

<a href="Orders.aspx">

Upvotes: 1

Related Questions