Javascript runtime error when deleting a row from a datatable
-
Thursday, September 13, 2012 10:22 PM
I'm getting a javascript runtime error that looks like this when I run through my code.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The given DataRow is not in the current DataRowCollection.
This is after I attempt to delete a row from a datatable like so. I checked the datatable and the row does exist. results.Any() returns true so I enter the if statement.
Any thought?
string filterExpression = "BhcRssd = '" + dataRow[2] + "' AND SubsidiaryRssd = '" + dataRow[9] + "'"; DataRow[] results = FrY8Logsheet.Tables[0].Select(filterExpression); if (results.Any()) { DataRow workRow = FrY8Logsheet.Tables[0].NewRow(); workRow["BhcRssd"] = dataRow[2].ToString(); workRow["SubsidiaryRssd"] = dataRow[9].ToString(); FrY8Logsheet.Tables[0].Rows.Remove(workRow); }
chuckdawit
- Moved by Bob ShenMicrosoft Contingent Staff Monday, September 17, 2012 2:54 AM (From:Visual C# General)
All Replies
-
Friday, September 14, 2012 5:43 AM
Hi witdaj,
You are more likely to get more efficient responses to ASP.NET issues at http://forums.asp.net where you can contact ASP.NET experts.
Bob Shen [MSFT]
MSDN Community Support | Feedback to us
-
Friday, September 14, 2012 6:18 AMAs per my assumption Your current code removes all rows and you try to fetch the record from the deleted row. Please check again you code
With Thanks and Regards
Sambath Raj.C
click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you
Happy Programming!

