Source view of HYPERLINK.ASPX
DotNet Funda: Code Viewer
hyperlink.aspx | hyperlink.aspx.cs
Close Window  
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
    <table width="100%" cellpadding="2" cellspacing="0">
        <tr valign="top" class="ArticleTitle">
            <td style="padding-left:10px;" valign="middle">
                asp:Hyperlink control</td>
        </tr>
        <tr>
            <td class="ArticleContents">
                Hyperlink control is used to jump to another location or to execute the script code.
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;</td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
    <div class="ArticleContents">
        Hyperlink control is used to jump to another location or to execute the script code.
        When rendered on the page, it implements an anchor &lt;a/&gt; tag. 
        <p>        
        Its properties like <span class="DemoCP">BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. </span>
        are implemented through style properites of &lt;a/&gt; tag. 
        You can set its Text either by setting Text property in the .aspx page or from server side page. (other properties can also be set from both pages)
        </p>        

        Following are some important properties that are useful.
        <table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
            <tr>
                <td class="DemoCP">NavigateUrl</td>
                <td>
                    Used to specify the location to jump to.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">ImageUrl</td>
                <td>
                    Used to place an image instead of text as Hyperlink.
                </td>
            </tr>
        </table>
        <!-- START - Demo Section -->
        <table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
            <tr>
                <td class="DemoTitle">
                    DEMO : Hyperlink
                </td>
                <td align="right">
                    <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/controls/hyperlink.aspx" target="_blank">Show Source Code</a>
                </td>
            </tr>
            <tr>
                <td>
                    Location wtih link as Text
                    <asp:HyperLink runat="Server" Text="Go to Button Control tutorial" NavigateUrl="~/tutorials/controls/button.aspx"></asp:HyperLink>
                </td>
                <td>
                    Location with link as Image
                    <asp:HyperLink runat="Server" NavigateUrl="~/tutorials/controls/imagebutton.aspx" ImageUrl="~/images/demobutton.gif" ToolTip="Go to ImageButton control tutorial"></asp:HyperLink>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                    Location with Confirmation box
                    <span onclick="return confirm('Are you sure to proceed?')">
                        <asp:HyperLink ID="HyperLink1" runat="Server" Text="Go to Button Control tutorial" NavigateUrl="~/tutorials/controls/button.aspx"></asp:HyperLink>
                    </span>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                <pre>
                    // location with link as Text
                    &lt;asp:HyperLink ID="HyperLink1" runat="Server" Text="Go to Button Control tutorial" NavigateUrl="~/tutorials/controls/button.aspx" /&gt;
                    
                    // location with link as Image
                    &lt;asp:HyperLink ID="HyperLink2" runat="Server" NavigateUrl="~/tutorials/controls/imagebutton.aspx" ImageUrl="~/images/demobutton.gif" ToolTip="Go to ImageButton control tutorial" /&gt;
                    
                    // Location wth Confirmation box
                    &lt;span onclick="return confirm('Are you sure to proceed?')"&gt;
                        &lt;asp:HyperLink ID="HyperLink2" runat="Server" Text="Go to Button Control tutorial" NavigateUrl="~/tutorials/controls/button.aspx" /&gt;
                    &lt;/span&gt;
                </pre>
                </td>
            </tr>
        </table>
        <!-- END - Demo Section -->
        </div>
    <br />
    
    <script language="javascript" type="text/javascript">
        function GiveAlertToUser()
        {
            alert("Hi Dear, Client side method worked.");
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>

Go Top