I declared a hyperlink in asp.net as follows;
<asp:HyperLink ID="hyp" runat="server" Text="new user"></asp:HyperLink>
but, I am not getting the underline link, where I could click on it and go to a new page.
HyperLink hyp = new HyperLink();
hyp.ID = "hyp";
hyp.NavigateUrl = "http://localhost/";
hyp.Visible = true;
Page.Controls.Add(hyp);
You are defining the link multiple times.
The first time is in your
ASPX-page. This time only theID– andText-property are set.The second time you create a new link, and this time you do not set the
Text-property (which is mandatory), by using:and
Your code-behind should just contain:
This part is optional, but based on your example does not seem necessary: