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

How to use a datatable as a data source ?

Thread ID:





44268 May 18,2006 04:03 PM UTC May 19,2006 01:34 PM UTC WinForms 2
Tags: GridControl
Amit Weisman
Asked On May 18, 2006 04:03 PM UTC

How to use a datatable as a data source ? Hi, I must be missing something. I would like to populate my grid control (windows application) by using a datatable. I looked at the samples and searched the KB and forum and I know that I can use this row: this.gridControl1.Model.PopulateValues (GridRangeInfo.Cells(1,1, numberofrows, numberofcolumns), dt); But I lost all the style information, mainly the columns names. I’l looking for something like : Gridcontrol.Model.DataSource = dt ; Where this option is hiding ? Thanks Amit


Administrator [Syncfusion]
Replied On May 19, 2006 03:47 AM UTC

Hi Amit , PopulateValues method gives you an easy way to copy data from any given datasource that implements the IList interface or is a Array to specified range of cells in the grid. It does n''t copy the datatable column header information. Do you want to display the datatable column header information on the grid?. You need to handle the QueryCellInfo event to set the cell text of the header row(0 th row) in a grid. Here is a code snippet. if(e.RowIndex == 0 && e.ColIndex > 0 && dt.Columns.Count >= e.ColIndex ) { e.Style.Text = dt.Columns[e.ColIndex - 1].ColumnName; } Here is a modified sample. http://www.syncfusion.com/Support/user/uploads/WindowsApplication48_3cea37c8.zip Please let me know if this helps. Best Regards, Haneef

Amit Weisman
Replied On May 19, 2006 01:34 PM UTC

Thanks Haneef.


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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