FilterColumn, FilterCriterion, FilterValue, SortColumn, and SortDirection Properties and Reset Method Example

The following code shows how to set the RDS.DataControl Server parameter at design time and bind it to a data-aware control using an ODBC data source called Pubs. Pubs ships with SQL Server 6.5. To try the example you will need rich text controls named txtSortcolumn, txtSortdirection, txtFiltercolumn, txtCriterion, and txtFilterValue, and an HTML Form Input Button named SortFilter.

<OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID=ADC HEIGHT=10 WIDTH=10>
<PARAM NAME="SQL" VALUE="Select * from Sales ">
<PARAM NAME="SERVER" VALUE="http://MyWebServer">
<PARAM NAME="CONNECT" VALUE="dsn=pubs;UID=sa;PWD=;">
</OBJECT>

<!-- Sheridan Grid -->
<Object CLASSID="clsid:AC05DC80-7DF1-11d0-839E-00A024A94B3A"
   CODEBASE="http://MyWebServer
/MSADC/Samples/Sheridan.cab"
   ID=GRID1 
      datasrc=#ADC 
      HEIGHT=125 
      WIDTH=495>
   <PARAM NAME="AllowAddNew" VALUE="TRUE">
   <PARAM NAME="AllowDelete" VALUE="TRUE">
   <PARAM NAME="AllowUpdate" VALUE="TRUE">
   <PARAM NAME="BackColor"   VALUE="-2147483643">
   <PARAM NAME="BackColorOdd"  VALUE="-2147483643">
   <PARAM NAME="ForeColorEven" VALUE="0">
</OBJECT>

<Script Language="VBScript">
<!--
Sub SortFilter_OnClick

   ' Set the values. txtSortcolumn is a rich text box
   ' control. The value of SortColumn will be the text
   ' value of what the user specifies in the
   ' txtSortcolumn box.
   If(txtSortcolumn.text <> "") then
      ADC.SortColumn = txtSortcolumn.text
   End If

   ' txtSortdirection is a rich text box
   ' control. The value of SortDirection will be the 
   ' text value of what the user specifies in the
   ' txtSortdirection box.
   Select Case UCASE(txtSortDirection.text)
   Case "TRUE"
      ADC.SortDirection = TRUE
   Case "FALSE"
      ADC.SortDirection = FALSE
   Case Else
      MsgBox "Only true or false are accepted for sort direction"
   End Select

   ' txtFiltercolumn is a rich text box
   ' control. The value of FilterColumn will be the 
   ' text value of what the user specifies in the
   ' txtFiltercolumn box.
   If (txtFiltercolumn.text <> "") Then
      ADC.FilterColumn = txtFiltercolumn.text
   End If

   ' txtCriterion is a rich text box
   ' control. The value of FilterCriterion will be the 
   ' text value of what the user specifies in the
   ' txtCriterion box.
   If (txtCriterion.text <> "") Then
      ADC.FilterCriterion = txtCriterion.text
   End If

   ' txtFilterValue is a rich text box
   ' control. The value of FilterValue will be the 
   ' text value of what the user specifies in the
   ' txtFilterValue box.
   If (txtFilterValue.text <> "") Then
      ADC.FilterValue = txtFilterValue.text
   End If

   ' Execute the sort and filter on a client-side
   ' Recordset based on the specified sort and filter
   ' properties. Calling Reset refreshes the result set
   ' that is displayed in the data-bound controls to
   ' display the filtered, sorted recordset.
   ADC.Reset

End Sub
-->
</Script>