473,320 Members | 2,027 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,320 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
dgEditEducation.ItemCommand
Select Case e.CommandName
Case "Update"
populateEducationQ()
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.BeginEdit()
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)
..SelectedItem.Text
dr("major") = CType(e.Item.FindControl("txtEdEMajor"), TextBox).Text
dr("eType") = "q"
dr.EndEdit()
Cache.Insert("tblEducation", tblEducation)
dgEditEducation.EditItemIndex = -1
BindEducationQ()
Case "Edit"
dgEditEducation.EditItemIndex = e.Item.ItemIndex
BindEducationQ()
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
BindEducationQ()
Case "Delete"
tblEducation = Cache.Get("tblEducation")
Dim dr As DataRow = tblEducation.Rows(e.Item.ItemIndex)
dr.Delete()
Cache.Insert("tblEducation", tblEducation)
BindEducationQ()
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 7309

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

Similar topics

2
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...
5
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...
2
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...
6
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...
2
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"...
4
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...
13
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;
3
luke14free
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...
3
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/...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.