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
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 7313

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: 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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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.