10 Answers, 1 is accepted
0
Accepted
Hi Dan,
You can use following code snippet:
I hope this helps. Don't hesitate to write us back if you have other questions.
Sincerely yours,
Julian Benkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can use following code snippet:
private void boundRadButton_Click(object sender, EventArgs e) |
{ |
if (this.radGridView1.SelectedRows.Count > 0) |
{ |
GridViewDataRowInfo[] rows = new GridViewDataRowInfo[this.radGridView1.SelectedRows.Count]; |
this.radGridView1.SelectedRows.CopyTo(rows, 0); |
this.radGridView1.GridElement.BeginUpdate(); |
for (int i = 0; i < rows.Length; i++) |
{ |
rows[i].Delete(); |
} |
this.radGridView1.GridElement.EndUpdate(); |
} |
} |
I hope this helps. Don't hesitate to write us back if you have other questions.
Sincerely yours,
Julian Benkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mark
Top achievements
Rank 1
answered on 05 Dec 2008, 04:41 PM
Delete is not an available method in GridViewDataRowInfo[] for Q2. What suggestions do you have for Q2? Upgrading is not an option.
0
Hello Mark,
Sorry for my omission. You can use the following snippet:
Sincerely yours,
Julian Benkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Sorry for my omission. You can use the following snippet:
private void boundRadButton_Click(object sender, EventArgs e) |
{ |
if (this.radGridView1.SelectedRows.Count > 0) |
{ |
GridViewDataRowInfo[] rows = new GridViewDataRowInfo[this.radGridView1.SelectedRows.Count]; |
this.radGridView1.SelectedRows.CopyTo(rows, 0); |
this.radGridView1.GridElement.BeginUpdate(); |
for (int i = 0; i < rows.Length; i++) |
{ |
this.radGridView1.Rows.Remove(rows[i]); |
} |
this.radGridView1.GridElement.EndUpdate(); |
} |
} |
Sincerely yours,
Julian Benkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Richard Slade
Top achievements
Rank 2
answered on 05 Jun 2009, 02:17 PM
I can't see how this code snippet will work, as it appears to delete the first couple of rows in the GridView and NOT the selected rows.
I know this post is for 2008 Q2 (?) and I'm using 2009 Q1.
What I'm trying to achieve is to delete all of the selected rows from a data bound GridView.
Regards.
I know this post is for 2008 Q2 (?) and I'm using 2009 Q1.
What I'm trying to achieve is to delete all of the selected rows from a data bound GridView.
Regards.
0
Hello Richard Slade,
Thank you for your question.
The snippet copies the selected rows to an array and then removes them from RadGridView one by one. May be you are after a different behavior? What do you mean by "it appears to delete the first couple of rows"?
Best wishes,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thank you for your question.
The snippet copies the selected rows to an array and then removes them from RadGridView one by one. May be you are after a different behavior? What do you mean by "it appears to delete the first couple of rows"?
Best wishes,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sunil
Top achievements
Rank 1
answered on 24 Sep 2009, 05:00 AM
Hi I am using version Q3 2008 win control library.
I am using this code in my form. It sometimes deleted the rows from the radGridView but sometime not.....
Do I need to make special settings in design time or runt time?
I am using this code in my form. It sometimes deleted the rows from the radGridView but sometime not.....
Do I need to make special settings in design time or runt time?
0
Sunil
Top achievements
Rank 1
answered on 24 Sep 2009, 07:02 AM
In continuation to my previous post..
I am able to delete the selected radGridview rows when i drop the radGridview in windows form. But when i drop it on the System.Windows.Forms.TabControl, selected rows are not deleted.
Thanx in advance...
I am able to delete the selected radGridview rows when i drop the radGridview in windows form. But when i drop it on the System.Windows.Forms.TabControl, selected rows are not deleted.
Thanx in advance...
0
Hello Sunil,
Thank you for writing. I tested the described behavior with the latest build and it behaves correctly. You can upgrade to the latest version or if this is not feasible please send a sample application so that I may debug it and provide a solution. I am looking forward to your reply.
Kind regards,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Kind regards,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gh Reza
Top achievements
Rank 1
answered on 11 Apr 2020, 12:45 PM
Hi
I have problem in deleting row in data bound mode. i do bind gridView to bindingSource like:
radGridView.datasource = bindingSource1;
When i delete a row at runtime , the selected row remove from binding source. in UserDeletingRow event i change the selected row state to Deleted state like :
row.Cells["EntityState"].Value = EntityState.Deleted;
finally i send bindingsource list to my entityframework repository for CRUD operations but my selected row in binding list deleted automatically and i lost that row must delete and finally the row never physically delete from database.
please help me.
thank you
0
Hello, Reza,
Please refer to the following help article demonstrating how to update the database once a row gets added/updated or deleted: https://docs.telerik.com/devtools/winforms/controls/gridview/populating-with-data/updating-the-database-with-ado.netI hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Our thoughts here at Progress are with those affected by the outbreak.