user662417
user662417

Reputation: 167

Gridview with delete option

I have a GridView which is like:

File Name   DateTimeUploaded    Type     
    Resume  1/13/2012 7:52:59 AM    .docx   Delete
    tiger   1/18/2012 7:56:31 AM    .docx   Delete
    Woods   1/18/2012 7:56:42 AM    .xlsx   Delete
    tiger   1/18/2012 7:57:43 AM    .xlsx   Delete

In gridview_rowdeleting I have :

GridView1.DeleteRow(e.RowIndex);
        GridView1.DataBind();

When I click on delete of second row which has tiger, the second and fourth rows get deleted. But I want to delete only the second row. How can I do this?

Upvotes: 0

Views: 114

Answers (2)

Symphonicmind
Symphonicmind

Reputation: 100

Have you tried

GridView1.Rows.RemoveAt(e.RowIndex);

Upvotes: 0

curtisk
curtisk

Reputation: 20175

All depends on what you have defined as the DataKeyNames for the grid, if you are using the "File Name" then anything named Tiger in your example would get deleted.

Upvotes: 1

Related Questions