473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP.NET - Deleting rows from an unbound gridview

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.

Feb 1 '07 #1
2 5436
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
"Greg" <sp**********@yahoo.co.ukwrote in message
news:11*********************@l53g2000cwa.googlegro ups.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.

Feb 1 '07 #2
On 1 Feb, 22:00, "Robson Siqueira" <rob...@robsonfelix.comwrote:
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"Greg" <spammesil...@yahoo.co.ukwrote in message

news:11*********************@l53g2000cwa.googlegro ups.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.
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.

Feb 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wannabe | last post by:
I have been trying to figure this out for days now...can someone please help? I am using ASP.Net 2.0 and have a gridview on my page. I have everything working except the delete command. The page...
1
by: =?Utf-8?B?QW1pdA==?= | last post by:
I have an object datasource control that is referencing a class in the app code directory called SQLCommands.vb. That class calls stored procs in a remote server. On my page I'm using a GridView...
1
by: Greg | last post by:
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...
11
by: Greg | last post by:
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...
2
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent...
2
by: mathewgk80 | last post by:
Hi all, when i try to delete the last row from gridview, i got an exception "Array index out of bound.. When i try to delete some other row, all the rows that follow that row is deleted.. ...
1
by: bJames | last post by:
Hi I've been all around looking for an answer to this question, but can't find it. I've got a gridview with a single unbound column. It's got a textbox and button in the footer row. I"m trying to...
0
by: Andy B | last post by:
I have the following gridview. There are 2 other textBoxes and a button on the page as well. When somebody puts text into the 2 textBoxes and presses the add button, it puts the values of those...
1
by: COHENMARVIN | last post by:
I have a gridview and I need to know the number of rows in it. I find the Page_load and the Gridview_Load events are too early to find out the number of rows. I can use the Gridview_databound...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.