Use the gridview to insert a new record

xiaoxiao2021-03-06  58

Introduction

By default the GridView control does not have support of inserting records. In this post I'm going to show you an example how you can use the GridView's FooterTemplate and the SqlDataSourceControl to insert a record.

The FooterTemplate in a GridView is column based (It will not be a separate table at the end of the GridView, instead if will be added at the end of the GridView but into a column). By making the example in this post as simple as .

The following code is a GridView where the Customer table located in the Northwind database is used The GridView will have three columns (CustomerID, CompanyName and ContactTitle) To each column there is a FooterTemplate with editable fields..:

<% @ Page language = "c #" classname = "default_aspx"%>