Commandargument row updating
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.
Grid View control is one of the most powerful controls in ASP. This control displays database records in typical tabular form, and provides features such as Sorting, Paging, Selection and Editing without writing a single line of code. Till now our Grid View is ready to be populated, now let’s write a method to populate the Grid View.To populate the Grid View, I am calling Bind Data() method from Page_Load event after checking Is Post Back property of the page, so the Grid View will only be populated when there is no postback on the page (when the page loads for the first time).So I have to specify how I want them to appear in the normal view and edit view.That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view). But how are you calling this function protected void Grid View1_Row Command()??
Text = "Music_ID: " Music_ID; }} that was really helpful information.
You can notice that I have kept Required Field Validator too inside the Edit Item Template as I want the textbox to be validated for empty data.
In the same way you can put any kind of Validation controls inside Edit Item Template to validate the form element while user will click Update link.
I had change the syntax error in c# as below: int current Row Index = Int32.
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?