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.
To configure one column as button
- Binding WebGrid to AccessDataSource.
- Open WebGrid.NET Designer, select WebGrid > RootTable > Columns from the TreeView and add a column.
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.
Property Value Name colBtn Caption Button Column ColumnType Button ButtonText GetCustomerID
Apply the following script to the page:
Apply this code into the InitializeRow event. Please see the comments for explanation.
- Run the sample.