Visual InterDev

bindAllColumns Method

See Also      Applies To

Makes all columns visible in the Grid object.

Syntax

object.bindAllColumns()

Parameters

object

A Grid script object

Remarks

The bindAllColumns method binds all the columns of the Recordset script object that is bound to the Grid script object. This is useful when changing the source of the recordset. Suppose that the original recordset contained four columns, and that you then called the setSQLText method to change the source of the recordset. Now suppose that the new recordset contains ten columns, instead of the original four. The bindAllColumns method enables you to display all ten columns.

Example

This example shows grid bound to a recordset that is set to the Categories table in the Northwind.mdb. When the user clicks Button1, the ChangeRS function is called in the onclick event. The recordset is closed and the SQL statement for the recordset is changed. The grid is then re-bound to the new recordset using bindAllColumns()

<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Sub Button1_onclick()
   call ChangeRS   
End Sub

Sub grid_onenter()
   ' The first time the recordset is opened, this sub defaults 
   ' to the SQL statement that was specified at design time.
   if thisPage.firstEntered then
      rs.open         
   end if 
End Sub

sub changeRS()
   ' The recordset must be closed before changing the SQL statement.
   if rs.isOpen() then rs.close()

   ' Reset the SQL statement to query a different table.
   rs.setSQLText( "Select * from Customers")
   rs.open   
   Grid1.bindAllColumns
end sub
</SCRIPT>