Form controls of type Link
and ImageLink are designed to render based on two important
values. In the case of a Link control, the Value property specifies
the text that will be visible to the user whereas for a ImageLink control, the
Value property contains the location of the image that is used in the
control. For both controls, the Value property can be set in the usual
way as is done with Label and Textbox controls i.e.
'ASP
FormName.FieldName.Value = "new_value"
//PHP
global $FormName;
$FormName->FieldName->SetValue("new_value");
However, Link
and ImageLink controls also contain a URL to the resources
that they link to. As such, both controls have a Page property that
can be used to programmatically set the URL for the control. e.g. the following
code entered in the Before Show event of the Link or ImageLink would set the
URL:
'ASP
FormName.FieldName.Page = "http://www.somewhere.com"
'the
URL could also be a relative URL to a local page
FormName.FieldName.Page
= "page.asp"
//PHP
global $FormName;
$FormName->FieldName->Page = "http://www.somewhere.com";
//the
URL could also be a relative URL to a local page
$FormName->FieldName->Page
= "page.php";
In the above code, FormName
and FieldName should be replaced with the actual
name of the form and field respectively.
In grid forms, Link controls
are used to link the records in the grid to the corresponding record in a record
form. In this case, the Link usually has one or more parameters to identify
the record to be opened in the record form. If you change the Page
property programmatically in the Before Show event of the control, the original
parameters for the control would still be retained. This would be an important
factor to bear in mind if you programmatically set a URL that contained parameters. |