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. General Programming
  3. C#
  4. How to delete a row from a dataGrid

How to delete a row from a dataGrid

Scheduled Pinned Locked Moved C#
helpdesignxmltutorialquestion
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.
  • I Offline
    I Offline
    Imran Adam
    wrote on last edited by
    #1

    Hello experts i would like to know how to delete a row from a dataGrid (which is in edit mode), i am using paging and the built in edit, update, cancel methods. I have been looking all over the posts most seem to be using databases and since i am using a XML file as my surce of data i am abit lost. heres what i have in my delete event Handler.. private void dgStudents_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { int rowToDelete = e.Item.ItemIndex; dsStudents.student.Rows[rowToDelete].Delete(); //refresh datagrid control to show changes BindData(); } the rowToDelete int will get the row to delete, but when i run this and click on delete, i get a runtime error of "There is no Row at position 0" Help please?? Cheers :)

    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