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. Delete row from gridview after bind

Delete row from gridview after bind

Scheduled Pinned Locked Moved ASP.NET
csshelpquestion
2 Posts 2 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.
  • P Offline
    P Offline
    playout
    wrote on last edited by
    #1

    Hi there, I want to delete a row from a gridview, once it has been populated. My user have some control over how he wants to see the gridview, but now wants to be able to deleted certain rows, when clicking a link. How will I delete the rows? I have the following code: Dim row As GridViewRow 'Delete Customers from grid For Each row In gdvUsers.Rows If (row.Cells(4).Text = "") Then 'delete row End If Next Any help will be appreciated.

    J 1 Reply Last reply
    0
    • P playout

      Hi there, I want to delete a row from a gridview, once it has been populated. My user have some control over how he wants to see the gridview, but now wants to be able to deleted certain rows, when clicking a link. How will I delete the rows? I have the following code: Dim row As GridViewRow 'Delete Customers from grid For Each row In gdvUsers.Rows If (row.Cells(4).Text = "") Then 'delete row End If Next Any help will be appreciated.

      J Offline
      J Offline
      jaysaran
      wrote on last edited by
      #2

      After Binding the data into the grid we have use this code: Dim row As GridViewRow Dim i As Integer 'Delete Customers from grid i = 0 For Each row In gdvUsers.Rows If (row.Cells(4).Text = "") Then gdvUsers.DeleteRow(i) End If i = i + 1 Next And include this row deleting event: Protected Sub gdvUsers_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles gdvUsers.RowDeleting gdvUsers.Rows.Item(e.RowIndex).Visible = False End Sub

      Best Regards

      JaySaran

      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