ComponentOne GridView for ASP.NET WebForms
Task-Based Help / Updating the Grid at Run Time
In This Topic
    Updating the Grid at Run Time
    In This Topic

    While you can use the RowUpdating event to edit the grid's underlying data source, another option is to use the client-side Update() method. The RowUpdating event gets fired when the client-side Update() method is called. In some situations you may prefer this method to send edits done by user to server in client-editing mode.

    In this example, you'll add a button that updates the grid when clicked. Complete the following steps:

    1. Select View | Markup to switch to Source view.
    2. Add the following markup just above the <cc1:C1GridView> tag to add a button to the application.
      <asp:Button ID="btn1" runat="server" Text="Update" OnClientClick="btn_ClientClick()" />
    3. Add the following markup inside the application's <head></head> tags:
    <script type="text/javascript">
    function btn_ClientClick(sender, args) {
    var grid = $("#C1GridView1");
    grid.c1gridview("endEdit");
    grid.c1gridview("update");
    }
    </script>

    This script will update the grid when the button is clicked.

    See Also