In this article we create a Gridview from database and add some additional operations such a add, edit and delete data in the Grid View control. In the previous article , we learned how to create a simple Grid View at runtime .
Sometimes we need to specify the format of the data from the database, and the way it is rendered in the table, more exactly. NET is a very powerful control that provides an easy interface to add, update, delete, and display data.
The Grid View also lets you perform other tasks very easily, such as paging and sorting your data, but not everything is as straightforward as it seems.
In many purposes we need to loop through Grdi View rows like for manipulation, replacement, padding characters etc. We can loop through Grid View rows using two ways: 1.
Use Grid View Row class to loop through or navigate the Grid View rows from outsite the Grid View control’s event. Use general for loop based on Grid View Rowcount method.
Most of the time, we would display the data exactly as it comes out of our datasources, but sometimes we may need to manipulate the text, cells, and rows to fit our needs.
In this article I will explain how to use the events and properties of the Grid View to allow us to customise the way the data appears.
Find Control("txtname"), Text Box) Dim stor_address As Text Box = Direct Cast(grid View.
Find Control("txtaddress"), Text Box) Dim city As Text Box = Direct Cast(grid View.
Grid View is great for very simple tables, but the real world is not always as straightforward as we would like it to be.
Sometimes we need to specify the format of the data, and the way it is rendered in the table, more exactly.
I filled the data Grid View as select *,' Update' as [Update] from table_name ; I created a very small test table Student.