Gridview rowupdating get new value

Rated 3.88/5 based on 645 customer reviews

This calls for some extra coding from developer's end. As an example we are going to use Employees table of the Northwind database. Add three Bound Fields and a Command Field to the Grid View with the help of Fields dialog (see below).

In order to develop a test web form create a new web site in VS. Set various properties of the Bound Fields as shown in the following table: Here, we call Bind Grid() method if the web form is being served as a result of first request.

Other templates used here are Edit Item Template and Footer Template. CREATE PROCEDURE [dbo].[employee_pro] ( @empid as int=0, @name as varchar(50)='', @address as varchar(50)='', @designation as varchar(50)='', @status as varchar(50)='' ) AS BEGIN SET NOCOUNT ON; if(@status = 'Display') begin Select * from employee end else if(@status = 'Add') begin Insert into employee(name,address,designation,createtime) values (@name,@address,@designation,getdate()) end else if(@status = 'Update') begin Update employee set [email protected], [email protected],[email protected] where [email protected] end else if(@status = 'Delete') begin Delete from employee where [email protected] end ENDStored cs using System; using System.

There are many articles and tutorials around that illustrate the use of Grid View control along with the new Data Source Controls.

The Sorting event handler receives an event argument of type Grid View Sort Event Args.

We set Page Index property of the Grid View to this new page number and call the Bind Grid() method again.

The Data View supplies all the records from the Employees table.

In order to implement paging you need to set Allow Paging property of the Grid View control to True. There are two events of Grid View that are related to paging.

When attached with a Data Source control Grid View performs tasks such as paging, sorting and editing automatically i.e. However, at times you require to bind the Grid View with a Data View or Data Table directly.

Fortunately Grid View can also be used without attaching with the Data Source Controls. In this article we will see how paging, sorting and editing can be implemented in a Grid View control that is bound with a Data View (or Data Table) directly.

Leave a Reply

  1. One to one webcams sexy chat rooms 09-Oct-2017 05:12

    And the new owner will never have to worry abut having too many shoes, clothes or accessories with eight closets at their disposal in the master suite.