We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Looking for a sampke that adds, deletes in C# code

Thread ID:

Created:

Updated:

Platform:

Replies:

94161 Apr 26,2010 08:54 PM UTC May 3,2010 08:44 AM UTC WPF 4
loading
Tags: GridControl
David Mecteaux
Asked On April 26, 2010 08:54 PM UTC

Hi,

I am looking for some sample code that lets you delete, insert, add a row in C# to the grid. I am also looking for some code that will do this with the currently selected row. I looked through a ton of the samples but didn't come across what I was looking for...

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On April 28, 2010 10:07 AM UTC

Hi David,

The v8.2 Install comes with a Stock Exchange Demo sample,

Syncfusion\EssentialStudio\8.2.0.18\WPF\Grid.WPF\Samples\3.5\WindowsSamples\Grid Data Control - Advanced\Stock Exchange Demo\CS

This sample does Add/Remove/Updates in the underlying ItemsSource that is bound to the GridDataControl. The Grid would automatically reflect those changes.

If you want to delete the SelectedItem, In your code you can do something as below, Consider Orders is the collection bound to the Grid,

this.Orders.Remove(this.DataGrid.SelectedItem);


Please let me know if this helps.

Thanks,
Fahad

David Mecteaux
Replied On April 28, 2010 01:38 PM UTC

Hi thanks for the response.

I am curious....if you reorder the data in the grid (like with a sort) and you use the code that you showed me....that will still delete the correct row?

David Mecteaux
Replied On April 28, 2010 02:09 PM UTC

Actually I do have one additional question. How can you get the integer index of the row that is selected on the grid?

Varun P [Syncfusion]
Replied On May 3, 2010 08:44 AM UTC

Hi David,

Sorry for the delay in getting back to you.

Regarding the sorting, this looks like a bug, We would like you to create an incident with the Forum Title as the Incident description for further follow up.

Regarding to get the integer index of the selected row, you can use the following code.

var rowIndex = this.dataGrid.Model.CurrencyManager.CurrentRecordIndex;

Please let me know if you have any queries.

Thanks,
Varun

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;