473,381 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,381 software developers and data experts.

"Deleted row information cannot be accessed through the row." WHY!!

hi guys, I have a problem with my datagrid. My form is set up so I have two
textboxes an add button and an editable

datagrid. The datagrid is bound to a datatable which is in my cache.When I
click the add button the contents of the

textboxes are insertedinto the datatabel in teh cache and the datagrid is
bound to it.

However the problem comes when I delete a row from the database and then
add and edit a row. Lets say my datagrid has only

one row, I delete it and then insert a new row. WHen I click on the Edit
button I get the following error

Deleted row information cannot be accessed through the row.

Heres my code for the editable datagrid
Private Sub dgEditEducation_ItemCommand(ByVal source As Object, ByVal e As

System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
Select Case e.CommandName
Case "Update"
tblEducation = Cache.Get("tblEducation")
Dim dr As DataRow
'find the row which has been clicked on
dr = tblEducation.Rows.Item(e.Item.ItemIndex) '.Find(CType
(E.Item.FindControl("lblEduID2"), Label).Text)
dr("institute") = CType(e.Item.FindControl("txtEdEInstitute"), TextBox).Text
dr("location") = CType(e.Item.FindControl("txtEdELocation"), TextBox).Text
dr("eYear") = CType(e.Item.FindControl("ddEdEYar"), DropDownList)
dr("major") = CType(e.Item.FindControl("txtEdEMajor"), TextBox).Text
dr("eType") = "q"
Cache.Insert("tblEducation", tblEducation)
dgEditEducation.EditItemIndex = -1
Case "Edit"
dgEditEducation.EditItemIndex = e.Item.ItemIndex
Dim dr As DataRow
tblEducation = Cache.Get("tblEducation")
dr = tblEducation.Rows(e.Item.ItemIndex)
Dim ddl As DropDownList =

CType(dgEditEducation.Items(dgEditEducation.EditIt emIndex).FindControl
("ddEdEYar"), DropDownList)
ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue((dr("eYear "))))
Case "Cancel"
dgEditEducation.EditItemIndex = -1
Case "Delete"
tblEducation = Cache.Get("tblEducation")
Dim dr As DataRow = tblEducation.Rows(e.Item.ItemIndex)
Cache.Insert("tblEducation", tblEducation)
dgEducation.ShowFooter = False
dgEducation.EditItemIndex = -1
End Select
End Sub

I really need to know what the problem is as its driving me nuts

Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
0 7313

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: jagdishkab | last post by:
When I try to connect to a MS Access 2000 database in enterprise Manager , i get an error "Login failed - Catalog information cannot be retrieved". I get this error message in a dialog...
by: DraguVaso | last post by:
Hi, Something I don't understand about a Typed DataSet: When a value in the DataSet is DBNull, it throws this error: "Cannot get value because it is DBNull". But aren't Typed DataSets...
by: michael Schindler | last post by:
I get an error message since i installed visual studio 2003 :-( Please help me why i get this message? An unhandled exception of type 'System.ObjectDisposedException' occurred in...
by: Rob R. Ainscough | last post by:
I'm not sure why I'm getting this error when searching thru my local hard drives using My.Computer.FileSystem.GetFiles? I've got FileIOPermissions set in code: Dim f As New...
by: Mr. SweatyFinger | last post by:
why why why why why why why why why why why Can't i get dim PlaceHolderPrice as placeholder = formview1.findcontrol("PlaceHolderPrice") <asp:FormView ID="FormView1" runat="server"...
by: Joao | last post by:
Hi all, I have 2 listboxes with SelectionMode = MultiExtended and I just cannot figure out why I get the error below: System.IndexOutOfRangeException was unhandled Message="Index was outside...
by: hn.ft.pris | last post by:
Hi: I have the following simple program: #include<iostream> using namespace std; int main(int argc, char* argv){ const double L = 1.234; const int T = static_cast<const int>(L); int arr;
by: luke14free | last post by:
Do you know why do I get that message when i type a normal setcookie function?? Warning: Cannot modify header information - headers already sent by (output started at...
by: Okonita | last post by:
Hi all, I am having problem completing this restore operation. "db2 restore database AAMI01 from /pap/data/backups taken at 20071002130554 to /pap/data/db01 into AAMI01 NEWLOGPATH /pap/data/new/...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.