Skip to end of metadata
Go to start of metadata

Configure one column of WebGrid as a button column to perform some client-side task.

During this walkthrough, you will learn how to do the following:

  • Configure one column of WebGrid as a button column.
  • Use WebGrid's InitializeRow event to set the button conditions.
  • Use Button_Click event to show alert.


In order to complete this walkthrough, you will need the following:

  • Visual Studio 2005 Application.

Step-By-Step Instructions

To configure one column as button

  1. Binding WebGrid to AccessDataSource.
  2. Open WebGrid.NET Designer, select WebGrid > RootTable > Columns from the TreeView and add a column.
  3. Set the ColumnType property of the new column to Button and the EditType property to NoEdit. You might also want to set the ButtonText and Caption properties.

    CaptionButton Column

  4. Apply the following script to the page:

  5. Apply this code into the InitializeRow event. Please see the comments for explanation.

  6. Run the sample.