ComponentOne GridView for ASP.NET WebForms
Task-Based Help / Binding the Grid to a Data Source / Automatically Updating the Data Source
In This Topic
    Automatically Updating the Data Source
    In This Topic

    This topic illustrates how to create an editable grid using templates and a DataSource control. Complete the following steps:

    1. Create a grid and bind it to a DataSource control; see Binding the Grid to a Data Source topic for details. Use the Suppliers table in the Northwind database and retrieve the SupplierID, CompanyName, ContactName, and Address fields.
    2. Configure UpdateQuery:
      1. Right-click the AccessDataSource1 component and then click Properties. In the Properties tab click the ellipsis button next to UpdateQuery. The Command and Parameter Editor dialog box appears.
      2. Click Query Builder, select the Suppliers table and click Add.
      3. Insert the following text in UPDATE command and click OK to close the Query Builder:
        UPDATE Suppliers SET CompanyName = ?, ContactName = ?, Address = ? WHERE (SupplierID = ?)
        
      4. Click the Add Parameter button and rename the parameter "SupplierID".
      5. Click Show advanced properties and set the Type property to Int32.
      6. In the same way, add CompanyName, ContactName, Address parameters, but set their Types to String.
      7. Click OK to close the Command and Parameter Editor dialog box.
    3. Right-click the C1GridView control and then click Show Smart Tag.
    4. On the C1GridView Tasks menu, in the Choose Data Source box, click AccessDataSource1, if necessary.
    5. Right-click the C1GridView control and click Properties. In the Properties window set the DataKeyNames value to SupplierID.
    6. In the Properties window, set the AllowClientEditing property to True.
    See Also

    Binding the Grid to a Data Source