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 .
Create an project and drag the gridview control then configure the database connection string in web.config file as shown below.
Allow Paging="true" Show Footer="true" Page Size="5" Width="75%" Data Key Names="Emp_id" On Page Index Changing="Grid View Sample_Page Index Changing" On Row Canceling Edit="Grid View Sample_Row Canceling Edit" On Row Editing="Grid View Sample_Row Editing" On Row Updating="Grid View Sample_Row Updating" On Row Command="Grid View Sample_Row Command" Border Color="#CCCCCC" Border Style="Solid" Border Width="1px" On Row Data Bound="Grid View Sample_Row Data Bound" In the above code, we have added the textbox, dropdown and checkbox in Edit Itemtemplate and Footer Template inside Template Field to edit and add the values.
Sql Client; public partial class _Default : System.
Open() Dim cmd As New Sql Command("Select * from stores", con) Dim da As New Sql Data Adapter(cmd) Dim ds As New Data Set() da.
To demonstrate data binding for a Drop Down List in a Form View switch the Form View to the Edit Item Template.