Image credit: commons.wikimedia.org
Adding Records in GridView in Asp.Net has always been a very fascinating topic for .Net developers. This method is not as hard as it looks. We have to see what we will be going to do in order to make the GridView Insertion Supportive Control.
Before showing you the addition process of GridView server control, let us see what is GridView and what is does?
What is GridView?
The GridView control is a peculiarity rich and flexible control used to acknowledge, show, and alter information on a page. It is a regularly utilized control as a part of ASP.Net web applications.
To utilize a GridView control a DataSource control must be connected to the GridView control. The property DataSourceID of the GridView control ties the GridView control to the DataSource control and permits paging, sorting and database operations associated with the DataSource.
There are four famous DataSource controls available: SqlDataSource control is one of them. We utilize SqlDataSource control, to append the GridView control to the Sql Server Information base.
The SqlDataSource control focuses mainly on these properties such as ConnectionString, SelectCommand, UpdateCommand and DeleteCommand properties. The ConnectionString property make the connecction to the DataSource control to the database and properties, for example, SelectCommand, InsertCommand, UpdateCommand, DeleteCommand contains SQL explanations that are executed when we show, embed and erase records utilizing the GridView control.
Here is the complete code: