This walkthrough shows you how to use the available client-side events to customize default client processing behavior.
During this walkthrough, you will learn how to do the following:
- Connect to a Microsoft Access database using Microsoft Jet 4.0 OLE DB Provider.
- Use OnRowSelect client side events to show the alert.
Prerequisites
In order to complete this walkthrough, you will need the following:
- Access to the Microsoft Access Northwind database.
- Visual Studio 2005 Application.
Step-By-Step Instructions
To create new web application and bind hierarchical WebGrid with DataSource
- Bind WebGrid to AccessDataSource.
- In LayoutSettings in IDE property window, expand ClientSideEvents.
- In OnRowSelect, open the dropdownlist and choose Add New Handler.
- Switch to HTML View and add the following function:
JavaScript Copy Code function DoRowSelect(gridId, tblName, rowIndex) { alert("The row index of selected row is : " + rowIndex); return true; }
The DoRowSelect function which is used to respond the RowSelect event has 3 parameters: gridId, tblName and rowIndex. You can do custom processing in the function and return true to process default behavior.
WebGrid is built with complete client object model API that can be used to programmatically access or modify a behavior setting. You can get the instance of the WebGrid object in client by using: var gridObject = ISGetObject(gridName);
The gridObject is the top most level object in the WebGrid client object model API. The gridObject contains Tables collection which contains Table object that defined in server side. Complete client side API documentation will be available in Intersoft's Developer Network.
- Compile and run the WebForm.
References
ClientEvents Class
OnRowSelect Property
Other Resources
Walkthrough Topics
How-to Topics