17 February 2014

Hyperlink - Basic Web Control

      The Hyperlink control is like the HTML <a> element.
Basic syntax for a hyperlink control:
       <asp: hyperlink id="hyperlink1" runat="server"> </asp:hyperlink>
Properties:

    ImageURL:Path of the image to be displayed by the control
    Navigate URL: Target link URL
    Text :The text to be displayed as the link
    Target:The window or frame which will load the linked page

Example for HyperLink Control


HTML View:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">    
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>asp.net HyperLink example: how to use</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:Red">HyperLink example</h2>  
        <asp: HyperLink    ID="HyperLink1"   runat="server"      Text="Visit Flying Crow Page"  
         NavigateUrl="~/FlyingCrow.aspx"  >  
        </asp: HyperLink>  
        <br />  
        <asp: HyperLink    ID="HyperLink2"   runat="server"  >  </asp:HyperLink>  
    </div>  
    </form>  
</body>  
</html>  

ASPX Page:


OutPut:





No comments:

Post a Comment