ID" Dim s Constr As String = Configuration Manager. Connection String Using conn As Sql Connection = New Sql Connection(s Constr) Using comm As Sql Command = New Sql Command(SQL, conn) conn. Data Bind() End Sub protected void Grid View1_Row Data Bound(object sender, Grid View Row Event Args e) protected void Grid View1_Row Updating(object sender, Grid View Update Event Args e) protected void Grid View1_Row Editing(object sender, Grid View Edit Event Args e) protected void Grid View1_Row Canceling Edit(object sender, Grid View Cancel Edit Event Args e) 0 Then Dim cbo Brand As Drop Down List = Direct Cast(e. Find Control("cbo Brand"), Drop Down List) Dim dt As Data Table Dim SQL As [String] = "SELECT * FROM Brand" Dim s Constr As String = Configuration Manager. Connection String Using conn As New Sql Connection(s Constr) Using comm As New Sql Command(SQL, conn) conn.

Find Control("lbl Book ID"), Label) If Val(lbl Book ID.

Books (Book Name, Category, Price) " & _ "VALUES(@Book Name, @Category, @Price)" .

CRUD is an acronym (short form) for create, read, update and delete.

We often use these four basic functions to perform database operations such as, inserting, retrieving, modifying etc. We first need a table, on which we do the CREATE TABLE [dbo].[Books]( [Book ID] [int] IDENTITY(1,1) NOT NULL, [Book Name] [varchar](50) NULL, [Category] [varchar](50) NULL, [Price] [numeric](18, 2) NULL PRIMARY KEY CLUSTERED ( [Book ID] ASC ) ) ON [PRIMARY] respectively.

The function takes a parameter, which is a reference of button.

Using the reference, I’ll first find out its “parent” control, and later loop through all the controls inside the parent to find the textbox named using System; using System. Find Control("tb Ed_Book"), Text Box) Dim tb Category As Text Box = Direct Cast(Grid View1. Find Control("tb Ed_Cate"), Text Box) Dim tb Price As Text Box = Direct Cast(Grid View1. Text) End If End If End Sub Protected Sub Grid View1_Row Deleting(sender As Object, e As System. The another problem is after populating how to display or show current database value by default in Drop Down List as a Selected Value in edit mode. In this example I will give you a complete solution on “How to operate Drop Down List in Grid View Edit Mode“ CREATE TABLE [dbo].[Brand]( [ID] [bigint] NOT NULL, [Name] [varchar](max) NOT NULL, CONSTRAINT [PK_Brand] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] CREATE TABLE [dbo].[Product]( [ID] [bigint] NOT NULL, [Name] [varchar](max) NULL, [Description] [varchar](max) NULL, [Brand ID] [bigint] NULL, CONSTRAINT [PK_Product_2] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] INSERT INTO Brand Values(1,'Kohinoor') INSERT INTO Brand Values(2,'Proctor & Gamble') INSERT INTO Brand Values(3,'Telenor') INSERT INTO Brand Values(4,'Unilever') INSERT INTO PRODUCT VALUES(1,'Lux Beauty Soap','Product of Unilever',4) INSERT INTO PRODUCT VALUES(2,'Tibbet Pomed','Winter Product',1) INSERT INTO PRODUCT VALUES(3,'Data SIM','Subscriber Identity Module',3) INSERT INTO PRODUCT VALUES(4,'Nippon','Color Television',1) Note: If you look at the Grid View events you will get onrowdatabound, onrowupdating, onrowediting, onrowcancelingedit events. Like onrowdatabound event will fire when Grid View Data Bind() method was called, onrowediting event will fire when user click on Edit link, onrowupdating event will fire when user click on Update link & onrowcancelingedit will fire when user click on Cancel link. New Page Index Bind Grid_With_Data() End Sub Protected Sub Grid View_Row Editing(By Val sender As Object, By Val e As Grid View Edit Event Args) Grid View1. New Edit Index Bind Grid_With_Data() End Sub Protected Sub Grid View_Row Canceling Edit(By Val sender As Object, By Val e As System.