Rowupdating index was out of range

Must be non-negative and less than the size of the collection. Parameter name: index"的关于数据索引值错误的问题,在网上查了许多,感觉都没有什么文章是直接指出解决问题的方法,先就总结下吧其实,这个问题在操作时是需要非常注意的,它并不在Grid View控件的Row Editing或者Row Updating方法中,而是需要在获取数据的类中指定Grid View控件的主键,后台代码如部分如下: 1 using System; 2 using System. Finally, to pull your hidden value that you’ve dubbed a Data Key in the Grid View’s subroutine.

protected void Grid View1_Row Editing(object sender, Grid View Edit Event Args e) { Grid View1. New Edit Index; Sql Connection con = new Sql Connection("Data Source=MEHDI-PC\SQLEXPRESS; Initial Catalog=PIMS; Integrated Security=True"); string sql = "select [Dwg Reg ID],[Ref],[Dwg_Ref],[Title],[Dwg_Received_Date],[Rev],[Trade],[Type],[Produced_Date],[Produced_By],[Submittal_Ref],[Issued_To],[Date_Issued],[Purpose],[Status],[Action_Date] from dbo. Row Index; If i enter the value of datakeynames new string[] then it is showing the error as Data Binding: ' System. Data Row View' does not contain a property with the name 'new string[] '.I am trying to use my own tables inside of a Gridview to update a customer's address info. Since you did not post your code I can not tell what you did and giving you advise is difficult but The first thing you're going to need to do is give the table an ID and runat="server" attributes. After that, I have never tried anything like that my self Thanks for writing. Basically, I was trying to convert an existing data-display-only Grid View (ie, no special functions) into one where I can update a field, namely the inventory for displayed products. New Edit Index 'set to selected row Bind Grid View() ' your own subroutine that you use to bind your datagrid End Sub Protected Sub Grid View1_Row Canceling Edit(By Val sender As System. After working with Data Grids so efficiently, I was scared that Grid Views were going to be a million times more complex.

Leave a Reply