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