HOWTO: How to Bind the Datagrid Control to the ADO Data Control on a Web Page

ID: Q233188


The information in this article applies to:


SUMMARY

To bind a Microsoft Datagrid Control 6.0 to a Microsoft ADO Data Control 6.0 with Microsoft Visual InterDev, it is not enough to just set the Datagrid DataSource property to point to the ADO Data Control in the design view as if using them inside a Visual Basic application. With the assumption that you are familiarize working with these ActiveX controls and Visual InterDev, this article describes the steps to make these two controls bind together.


MORE INFORMATION

In order to make the Datagrid Control bind to the ADO Data Control, the following steps are needed.

  1. Create new a html page in Visual InterDev


  2. Insert the ADO Data Control and Datagrid Control in the page


  3. Set the properties of the ADO Data Control to connect to a database


  4. Resize Datagrid Control, so it will appear big enough to display data on the page


  5. To bind the Datagrid Control with the ADO Data Control when the page loads, you would write the following codes in the window_onload event. Otherwise you would write these codes in other events.
    
    <SCRIPT LANGUAGE=vbscript>
    <!--
    	Sub window_onload()
              ' Datagrid1 is the id of the Datagrid control
              ' Adodc1 is the id of the ADO Data Control
    	  Set Datagrid1.DataSource = Adodc1.Recordset
    	End sub
    //-->
    </SCRIPT> 


  6. Save this html page and view it under Microsoft Internet Explorer. You will see the data is displayed on the Datagrid control.



Note: These controls are licensed controls, you might need to add the license for these controls to view this page on machines that do not have the required license. Please see
Q159923 HOWTO: Using Licensed ActiveX Controls in Internet Explorer


REFERENCES

For more information, please see the MSDN Web Workshop:

http://msdn.microsoft.com/workshop/default.asp

To learn more about Microsoft Visual InterDev, please go to http://msdn.microsoft.com/vinterdev/
To learn more about the ADO Data Control and Datagrid Control, please reference to your Visual Basic Menu or searchMSDN Online

Additional query words: ADODC DATAGRID DataSource


Keywords          : kbActiveX kbSBNWorkshop kbGrpInet 
Version           : WINDOWS:4.0,4.01,4.01 SP1,4.01 SP2,5.0
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: July 27, 1999