asp.net.ph

HyperLink.Target Property

System.Web.UI.WebControls Namespace   HyperLink Class


Sets or retrieves the target window or frame in which to load the content of the requested resource.

Syntax


Inline <asp:hyperlink target = strTarget | '_blank' | '_parent' | '_self' | '_top' ... >
Script HyperLink.Target [ = strTarget | '_blank' | '_parent' | '_self' | '_top' ]

Property Value


strTarget The name of the target window or frame to load the Web page content into.

Values must begin with a letter in the range of A-Z or a-z, except for these special values which begin with an underscore:

_blank Renders the content in a new, unframed window.
_parent Renders the content in the immediate frameset parent.
_self Renders the content in the current frame.
_top Renders the content in the full, unframed window.

The property is read/write with a default value that depends on the URL and site. If the user does not leave the site, the default is _self, but if the user exits to a new site, the default is _top.

Remarks

Use this property to specify the frame or window in which to display the contents of the requested resource.

If there is no frame or window that matches the specified target, a new window is opened for the link.

CAUTION: In HTML 4.0, Target attribute values are case-insensitive, so that _top and _TOP have the same meaning. However, most browsers treat this value as case-sensitive and do not recognize _TOP as having the special meaning as described for _top.

Example

The below snippet shows how to declaratively set the Target property of a HyperLink control at design time.

<asp:hyperlink runat = "server" 
   target=_blank text = "Simply awesome"
   navigateurl = "~/index.aspx" />

The following example, from our Books and More storefront application, illustrates using the Target property to open the Amazon.com details page for the current item in a new window.

<asp:hyperlink runat = "server" target = "details"
   navigateurl='<%# ( ( DataRowView ) Container.DataItem ) [ "url" ] %>'
   tooltip='<%# ( ( DataRowView ) Container.DataItem ) [ "productname" ] %>'>
   <img border=0 
      src='<%# ( ( DataRowView ) Container.DataItem ) [ "imageurlmedium" ] %>' 
      onMouseOver = "status='View Amazon page for this item.';return true" />
</asp:hyperlink>

 Show me 

See Also

HyperLink Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph