By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

Deleting rows from DataGrid

P: n/a
My DataGrid is bound to DataView as follow

DataGrid1.DataSource = myDS.Tables("Client_Consultant").DefaultView

User can either delete all the rows in the DataGrid on by pressing "Delete All" button or provide Client_Consulatnt_ID and press "Delete" button to delete rows with that Client_Consulatnt_ID. My question is:

1. How can i delete all the rows on click of a button.

2. How can i remove all the rows with particular Client_Consulatnt_ID

thanx

Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
DataTable.Clear or loop through and call .Delete on each row - you'll do the
same for specific rows (call Delete on their respective index).

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:D3**********************************@microsof t.com...
My DataGrid is bound to DataView as follow

DataGrid1.DataSource = myDS.Tables("Client_Consultant").DefaultView

User can either delete all the rows in the DataGrid on by pressing "Delete All" button or provide Client_Consulatnt_ID and press "Delete" button to
delete rows with that Client_Consulatnt_ID. My question is:
1. How can i delete all the rows on click of a button.

2. How can i remove all the rows with particular Client_Consulatnt_ID

thanx

Jul 21 '05 #2

P: n/a
That really depends on a few things, mainly if the grid is sortable or not.
If it is, the index is pretty much worthless b/c it won't be the same as it
appears in the grid.. Probably the simplest way is bind to a dataview, set
it's RowFilter property, then just delete those indexes directly. If you
filtered out 100 records so only one showed, called DataViewName[0].Delete,
you'd delete that row.

Is that what you need?

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:91**********************************@microsof t.com...
how wud i find index for rows with specified Client_Consulatnt_ID?

"William Ryan eMVP" wrote:
DataTable.Clear or loop through and call .Delete on each row - you'll do the same for specific rows (call Delete on their respective index).

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:D3**********************************@microsof t.com...
My DataGrid is bound to DataView as follow

DataGrid1.DataSource = myDS.Tables("Client_Consultant").DefaultView

User can either delete all the rows in the DataGrid on by pressing
"Delete All" button or provide Client_Consulatnt_ID and press "Delete" button to
delete rows with that Client_Consulatnt_ID. My question is:

1. How can i delete all the rows on click of a button.

2. How can i remove all the rows with particular Client_Consulatnt_ID

thanx


Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.