ASP.NET - Deleting rows from an unbound gridview

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

I have a gridview on my form which I have populated using a
datareader. What I would like to do is to be able to remove specified
records from the gridview, without affecting the source of the data.

I'm a bit confused about how to go about removing the rows - all the
google searches I have done so far seem to assume that the grid view
is bound and the programmer wants to delete the data from the original
source. Is there any easy way to do this - i.e. delete row x from the
grid?

I'd be grateful for any help with this!

Greg.
 
Greg,

There is just one way to do it, IMHO. Probably you have a primary key,
right? The options I can give you are:

a) create a new column on your main table - the one with the primary key -
changing it to show or hide the record
b) add the primary key value of each deleted record to a list. When reading
the values from the database, check to see if the PK is not on your internal
list.

I hope it helps.
 
Greg,

There is just one way to do it, IMHO. Probably you have a primary key,
right? The options I can give you are:

a) create a new column on your main table - the one with the primary key -
changing it to show or hide the record
b) add the primary key value of each deleted record to a list. When reading
the values from the database, check to see if the PK is not on your internal
list.

I hope it helps.

Thanks Robson, but I can't edit the table of the database that I have
read the data from! My brief is to read the data from the table, let
the user add or remove details at the web front end, and then to
update a different table with the results.

Greg.
 
Back
Top