Click here to Skip to main content
15,917,566 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ALL,

I have just used this code for deleting in GRID..Can any body plz tell me how can i apply a check of Editing as well?????

C#
Protected Sub GridView1_RowDeleting1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
    Dim dt As DataTable = DirectCast(Session("datatable1"), DataTable)
    dt.Rows.Remove(dt.Rows(e.RowIndex))
    Session("datatable1") = dt
    Me.GridView1.DataSource = DirectCast(Session("datatable1"), DataTable).DefaultView
    Me.GridView1.DataBind()
End Sub
Posted
Comments
deepankarbhatnagar 21-Nov-15 2:01am    
Yes, you can use GridView1_RowEditing() event for editing
Member 12119549 21-Nov-15 2:39am    
i know it is ..but what code we write behind it.. here i just got the index ..but
dt.Rows.Remove(dt.Rows(e.RowIndex))
in this line ..how can i make changes?

1 solution

try RemoveAt method

C#
dt.Rows.RemoveAt(e.RowIndex)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900