In this article we will introduce with HyperLink control in ASP.NET using C#.
HyperLink Example in ASP.NET using C#
HyperLink control in ASP.NET is used to link another webpage when the control is clicked. In this example we use two HyperLink. When we click the HyperLink it will redirect another page. The path of the web page will be given in NavigateUrl field.
HyperLink.aspx (Design page):
HyperLink.aspx (source code):
<%@ Page Title="" Language="C#" MasterPageFile="~/RoseindiaMaster.master" AutoEventWireup="true" CodeFile="HyperLink.aspx.cs" Inherits="HyperLink" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div> <h2 style="color:Green">HyperLink in ASP.NET 4 , C#</h2> <asp:HyperLink ID="hylink1" runat="server" NavigateUrl="~/DropDownList.aspx" Target="_top" >DropDownList Example</asp:HyperLink> <br /> <br /> <asp:HyperLink ID="hylink2" runat="server" NavigateUrl="~/Calendar.aspx" Target="_top" >Calendar Example</asp:HyperLink> </div> </asp:Content>
Output:
The output will be shown in following figure.
When you click DropDownList Example the web page will redirect on DropDownList.aspx. You can see in the following figure.
Download source code
[ 0 ] Comments