Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. "Deleted row information cannot be accessed through the row." WHY!!

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

Scheduled Pinned Locked Moved ASP.NET
helpdatabasedesignannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gamerPotatoe
    wrote on last edited by
    #1

    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.EditItemIndex).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")

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups