473,786 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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(By Val source As Object, ByVal e As

System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
dgEditEducation .ItemCommand
Select Case e.CommandName
Case "Update"
populateEducati onQ()
tblEducation = Cache.Get("tblE ducation")
Dim dr As DataRow
'find the row which has been clicked on
dr = tblEducation.Ro ws.Item(e.Item. ItemIndex) '.Find(CType
(E.Item.FindCon trol("lblEduID2 "), Label).Text)
dr.BeginEdit()
dr("institute" ) = CType(e.Item.Fi ndControl("txtE dEInstitute"), TextBox).Text
dr("location") = CType(e.Item.Fi ndControl("txtE dELocation"), TextBox).Text
dr("eYear") = CType(e.Item.Fi ndControl("ddEd EYar"), DropDownList)
..SelectedItem. Text
dr("major") = CType(e.Item.Fi ndControl("txtE dEMajor"), TextBox).Text
dr("eType") = "q"
dr.EndEdit()
Cache.Insert("t blEducation", tblEducation)
dgEditEducation .EditItemIndex = -1
BindEducationQ( )
Case "Edit"
dgEditEducation .EditItemIndex = e.Item.ItemInde x
BindEducationQ( )
Dim dr As DataRow
tblEducation = Cache.Get("tblE ducation")
dr = tblEducation.Ro ws(e.Item.ItemI ndex)
Dim ddl As DropDownList =

CType(dgEditEdu cation.Items(dg EditEducation.E ditItemIndex).F indControl
("ddEdEYar") , DropDownList)
ddl.SelectedInd ex = ddl.Items.Index Of(ddl.Items.Fi ndByValue((dr(" eYear"))))
Case "Cancel"
dgEditEducation .EditItemIndex = -1
BindEducationQ( )
Case "Delete"
tblEducation = Cache.Get("tblE ducation")
Dim dr As DataRow = tblEducation.Ro ws(e.Item.ItemI ndex)
dr.Delete()
Cache.Insert("t blEducation", tblEducation)
BindEducationQ( )
dgEducation.Sho wFooter = False
dgEducation.Edi tItemIndex = -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 7386

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

Similar topics

2
9295
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 box about 5 or 6 times. The
5
7473
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 invented to make life easier, to be able to get to tge Tables and Values with less code, in less time? But with this thing you need to add a Try-Catch around every statement when using the value, add for each value a default value in your DataSet (and...
2
4316
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 system.windows.forms.dll Additional information: Cannot access a disposed object named "DataGridTextBox".
6
12588
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 FileIOPermission(PermissionState.Unrestricted) f.AllFiles = FileIOPermissionAccess.AllAccess But I still get this error? Any work arounds to this?
2
2251
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" DataKeyNames="AdNum"
4
2432
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 the bounds of the array." Source="System.Windows.Forms" Listbox Data:
13
27441
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
1300
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 c:\programmi\easyphp1.8\www\home.php:5) in c:\programmi\easyphp1.8\www\functions.php on line 92 Thanks
3
8096
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/ log WITH 2 BUFFERS BUFFER 1024" SQL1326N The file or directory "/pap/data/db01/" cannot be accessed. The file, directory and path all exist. I created them. I just can't
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.