object.Link [=value]
The Link property stores the URL (including the query string) that is assigned to the HREF attribute of the HTML link (<a...> tag). This property is used only by the Link and Image Link controls. When read, the link value is constructed as concatenation of two components: one that holds the bare URL (Page property) and the other one that stores the query string (Parameters property). When written, the new value is split into the URL part and query string part. After the assignment, new URL is available through the Page property and new query string is available through the Parameters property.
Important: The assigned value must be a proper link. For example the query string must not include question marks (?). Such corrupt query string will be ignored.
The following example changes the link's label and hyperlink depending on whether
hidden field is set or not. Either link to parent category edit page is provided,
or if edited category is top level, the link points to categories listing page.
The example assumes EditCategoryForm exists on EditCategory
page. There is ParentLink link control inserted and parent_id
hidden field. Categories is a page that lists all top-level categories
navigated if no parent category is specified in the record.
If Not IsEmpty(EditCategoryForm.parent_id.Value) Then EditCategoryForm.ParentLink.Value = "go to parent category" EditCategoryForm.ParentLink.Link = "EditCategory.asp?parent_id=" & EditCategoryForm.parent_id.Value Else EditCategoryForm.ParentLink.Value = "root category (go to listing)" EditCategoryForm.ParentLink.Link = "Categories.asp" End If
Another example changes the link's target address depending on whether the user is logged
in or not. Either link to login page or to the user's profile page is given.
This example assumes there is WelcomeLink control inserted
within common includable page called Header. If the user is logged
in, a link to EditProfile page is provided (and the link's label is
changed). If the user is not logged in, a login prompt is displayed and Login
page link is provided.
If CCGetUserID() Then Header.WelcomeLink.Value = "Welcome " & CCGetUserLogin() Header.WelcomeLink.Link = "EditProfile.asp" Else Header.WelcomeLink.Value = "Please log in" Header.WelcomeLink.Link = "Login.asp" End If