Rowupdating index was out of range
As per described in the comments below you would need to mention the column index that you would want to delete with the I feel that the item index that you are passing is creating a problem.First of all check the whether the index of the row that you want to delete exists in the the data table and does it match the index of the row that you are trying to delete. - The gridview has a button "Delete" for deleting a row. Grid View1_Row Deleting(Object sender, Grid View Delete Event Args e) in e:\Desktop Items\Cheema\Web Sites\payrolldemo\finalformlayout\state_cs:117 System. The flow of module is like this: - When the form loads, the gridview is binded with the data from the database. Grid View Row Collection.get_Item(Int32 index) 10 finalformlayout_state_master. It could be related to the way youre populating your gridview, or the way youre setting your Grid View to store the Data Keys, could you post both codes, where you set up your Grid View component on your page (the html code) and where you populate it?EDIT: I have tried your example, and the only diferrence is that I aquire a datasource from a List intead of a Data Source control, is running perfectly here, and I Ctrl c/Ctrl v your code, so take a look; public class My Class @Soner for this aproach to work, you should have a property containing your product Id, just like the example above, where I define an int prop to represent it at My Class. Text; Line 118: string strstate = "delete from tb_citystate_master where citystate_nm= '" delval "'"; But when I check with the database the record is deleted.
Not downvoting, but this is a bad answer, because you are running this check for every row in the Grid View.This error exception is thrown mostly when you try accessing an item at an index that isn't present.The best way to resolve the issue is to debug and check the length of the array or the data table indexes and then see whether you are deleting the correct index or not. Grid View Update Event Args) Handles Data Grid Odin. Open() mycommand = New Sql Command("sp_Service Updt", myconnection) mycommand.
Search for rowupdating index was out of range:
If it helps, paste up the full exception message generated - the one that shows the stack trace.