Home All Groups Group Topic Archive Search About

ASP.NET - Deleting rows from an unbound gridview

Author
1 Feb 2007 7:16 PM
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.

Author
1 Feb 2007 10:03 PM
Robson Siqueira
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.

--
Regards,
Robson Siqueira
Enterprise Architect
Show quote
"Greg" <spammesilly1@yahoo.co.uk> wrote in message
news:1170357395.628881.184650@v45g2000cwv.googlegroups.com...
>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.
>
Author
1 Feb 2007 10:04 PM
Robson Siqueira
By the way, next time instead of post the same subject on different
newsgroups, try to copy them, if necessary.

--
Regards,
Robson Siqueira
Enterprise Architect
Show quote
"Greg" <spammesilly1@yahoo.co.uk> wrote in message
news:1170357395.628881.184650@v45g2000cwv.googlegroups.com...
>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.
>
Author
1 Feb 2007 10:47 PM
RobinS
Or better yet, cross-post them, i.e. post it in all the newsgroups at one
time. That way if someone in one group has an answer, the people in the
other groups can see it.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------------
Show quote
"Robson Siqueira" <rob***@robsonfelix.com> wrote in message
news:%237xhvzkRHHA.3316@TK2MSFTNGP02.phx.gbl...
> By the way, next time instead of post the same subject on different
> newsgroups, try to copy them, if necessary.
>
> --
> Regards,
> Robson Siqueira
> Enterprise Architect
> "Greg" <spammesilly1@yahoo.co.uk> wrote in message
> news:1170357395.628881.184650@v45g2000cwv.googlegroups.com...
>>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.
>>
>
>

AddThis Social Bookmark Button