Many a times in our applications we use primary keys to get control of the particular record in the gridview. For this situation, many developers use invisible columns (Hidden columns) in the gridview to identify that row.
The datagrid is filled with data from an XML datasource (e4x).We can achieve the same functionality using Datakeys. In this example, I am going to retrieve values from categories table of Northwind database. Drag a Grid View into the Web Form and assign Data Key Names property with the primary key column i.e. In the gdview_Row Editing and gdview_Row Deleting event, we have used the below code to retrieve categoryid from datakey of Grid View, int catid = int. Every time I add or remove a row form the table (by updating the data source through e4x expressions), the table sort is lost.The small sort-arrow in the coloumn header disappears, and the table contents are updated to show the rows un-sorted.Add a Data Grid View control and two Buttons on a Form. This will be something like…(please check out code syntax) Integer i = Data Grid View1. Dynamic SQL generation for the Update Command is not supported against a Select Command that does not return any key column information………. my first form is datagridview …side buttons is.,edit, delete,and close…now i want add some details then click add button then open another form….insert the data from add form…add form close after inserted data…..i want automatic refresh the form1…… When you click add button , close the datagrid form, open up the add data form.