Creating hyperlinks

You can add a link to a column, computed field, bitmap, or text control in a WebDataWindowControl in the control's Properties window:

  1. In the Properties window for a WebDataWindowControl, click the ellipsis button in the ObjectLinks field.

  2. In the ObjectLink Collection Editor, click Add to add a new object link.

  3. Specify values for the ObjectName and LinkUrl properties, and optionally the LinkTarget and LinkArguments properties.

  4. To set the LinkArguments property, with the new object link selected, click the ellipsis button in the LinkArguments field to open the LinkArgument Collection editor. Click Add to add a new link argument and specify a name, type, and value. If you select DataWindowColumn as the type, clicking the ellipsis button in the Value field displays a list of columns in the DataWindow. If you select DataWindowExpression, the Edit DataWindow Expression dialog box displays.

  5. Click OK to return to the ObjectLink Collection Editor.

The ObjectLink object generates an HTML hyperlink for the selected control. If the control is a column, the HTML is generated only if the column is readonly (its tab order in DataWindow Designer is 0).

The ObjectLink class encapsulates the HTML.Link, HTML.LinkArgs, and HTML.LinkTarget properties of the DataWindow object's column, computed field, bitmap, or text controls, using the ObjectName property to identify the control.

You can specify values for the DataWindow object properties on the HTML page in the Properties view for the control in DataWindow Designer. Values you specify in the ObjectLink Collection Editor override values set in the painter.

If you set link values in the painter, you need to set them in the Properties window only if you want to override the properties set in the painter. For information about setting these properties in DataWindow Designer, see the description of the properties in the DataWindow Object Reference.

This button Clicked event example shows some of the code needed to generate links using WebDataWindowControl properties. It sets up link arguments for customer id and company name columns, and object links that jump to a Customer Orders page and a Customer Details page:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
   Dim objlink_col As New
      Sybase.DataWindow.Web.ObjectLinkCollection

   Dim linkarg_col As New
       Sybase.DataWindow.Web.LinkArgumentCollection
   Dim larg1 As New Sybase.DataWindow.Web.LinkArgument

   larg1.Name = "custid"
   larg1.Type = Sybase.DataWindow.
      Web.LinkArgumentType.DataWindowColumn
   larg1.Value = "id"
   linkarg_col.Add(larg1)

   Dim larg2 As New Sybase.DataWindow.Web.LinkArgument
   larg2.Name = "company"
   larg2.Type = Sybase.DataWindow.
      Web.LinkArgumentType.DataWindowColumn
   larg2.Value = "company_name"
   linkarg_col.Add(larg2)

   Dim objlink1 As New Sybase.DataWindow.Web.ObjectLink
   objlink1.ObjectName = "id"
   objlink1.LinkUrl = "CustomerOrder.aspx"
   objlink1.LinkArguments.Add(linkarg_col.Item(0))
   objlink1.LinkArguments.Add(linkarg_col.Item(1))

   objlink_col.Add(objlink1)

   
Dim objlink2 As New Sybase.DataWindow.Web.ObjectLink
   objlink2.ObjectName = "edit"
   objlink2.LinkUrl = "CustomerDetails.aspx"
   objlink2.LinkArguments.Add(linkarg_col.Item(0))
   objlink_col.Add(objlink2)

   dw_1.ObjectLinks.Add(objlink_col.Item(0))
   dw_1.ObjectLinks.Add(objlink_col.Item(1))

End Sub

Here is the ObjectLinks tag in the Customer Orders .aspx page:

<ObjectLinks>
   <dw:ObjectLink ObjectName="sales_order_id"
      LinkUrl="CustomerOrder.aspx">
      <LinkArguments>
         <dw:LinkArgument Type="DataWindowColumn"
            Name="orderid"
            Value="sales_order_id"></dw:LinkArgument>
      </LinkArguments>
   </dw:ObjectLink>
</ObjectLinks>