Grid View control Row Command event will give you the Product ID of the product from the Grid View Rows when user will click any of the button in the Grid View. To handle click event of the buttons in Grid View you need to handle Row Command event of the Grid View control.
Following code will show you how you can get Row Index, Product ID and Command Name of the button when user click any button in the Grid View.
This enables you to provide an event-handling method that performs a custom routine whenever this event occurs.
Command Argument: The Command Argument can contain any string set by the programmer.
The most important thing for me is to get the index of the row on which the button was clicked.please try to reply. I am trying to fill a 2nd grid view using input parameters including data from the 1st grid view rows using a stored procedure when the button in that row is clicked. I got a string object conversion when with the following lineint current Row Index = Int32. Command Argument); The fix is as below and then worked fine.
Text = "Product ID: " & Product ID End Sub The code did not work.. I fixed the syntax mistakes and it didnt work still. Now how do you get the those buttons to display data when clicked?
I am not able to get the changed values that i enter in the grid view .
My best effort got me the value that was in gridview before editing or changing.
Each column represents a field, while each row represents a record.
Net Grid View control in order to add new record to the database.
On the onclick event if the button the records are inserted into the SQL Server Database and the Grid View is updated You can view above I am simply getting the data from the textboxes in the Footer Row and then firing an update query along with the select query so that the ASP. The figure below displays the Edit and Update functionality.
Command Name: Command Name property to determine the command to perform.
The Command Argument property complements the Command Name property by allowing you to provide any additional information for the command to perform.