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

Adding rows to datagrid

Thread ID:

Created:

Updated:

Platform:

Replies:

309 Jun 1,2002 05:02 AM UTC Jun 1,2002 08:26 AM UTC WinForms 1
loading
Tags: FAQ
yap
Asked On June 1, 2002 05:02 AM UTC

How do I add a new row to the data grid? I have also tried the code to select a row when a cell is clicked. But how do I revert it back to just selecting the cell?

Clay Burch [Syncfusion]
Replied On June 1, 2002 08:26 AM UTC

You have to add the rows to the underlying datasource. If the datagrid's datasource is a datatable, then code such as this should append rows. DataTable dt = (DataTable) this.dataGrid1.DataSource; //if table has two text columns dt.Rows.Add(new object[] {"Blah1", "Blah2"}); dt.AcceptChanges(); To selectively have single row selection, you could add a bool property to the derive datagrid, and text this property in the two mouse overrides. If this property is true, execute the code that is there now. If this property is false, just call the base class for each of the mouse overrides. This should return the functionality to the default selection behavior.

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

;