Gridview rowupdating commandfield


In my approach, you can leave the commandfield as is, then you can hide it as needed via code behind.In this example, I am hiding it if the field "Scenario" of the grid shows the text "Actual" for the relevant row of the Row Data Bound event.If you do this, your Grid View's source will be refreshed before you're able to grab the new values out of it.

' When we use Using statement, ' we don't need to explicitly dispose the object in the code, ' the using statement takes care of it.

Using conn As New Sql Connection(Configuration Manager. Dim ds Person As New Data Set() ' Create a SELECT query.

Step 2: We will see a Gird View control on the page, you can add, edit, delete the columns of the Grid View control, the data is come from App_Data/Grid file, and the Grid View's status is stored in View State for persisting data across postbacks.

Step 3: The Grid View the page size is 15, you need insert 16 Persons in this Grid View to see the next page. NET Empty Web Application" in Visual Studio 2010 or Visual Web Developer 2010. The project includes two web form pages for demonstrating two ways to bind data source with the Grid View, name them as "Data From Data Base.aspx", "Data In Memory.aspx". Before we start to write code, we need install Sql Server 2008 R2 Express and create a database file as the data source of Grid View control.

The sample demonstrates data source from both database and memory. Page Index Changing Event Protected Sub gv Person_Page Index Changing(By Val sender As Object, By Val e As Grid View Page Event Args) ' Set the index of the new display page.