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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add a row from DataTable to GridBoundGrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

22291 Dec 9,2004 12:30 AM UTC Dec 10,2004 07:38 AM UTC WinForms 5
loading
Tags: GridControl
David Bosak
Asked On December 9, 2004 12:30 AM UTC

Hi, How to add a row from DataTable to GridBoundGrid at a time? Thanks, D.B

Administrator [Syncfusion]
Replied On December 9, 2004 07:49 AM UTC

I am not sure I understand your question. The GridDataBoundGrid just displays exactly what is in the datasource that you set to it. So, if you have a DataTable with 15 rows, and your make this DataTable the DataSource for the grid, then the grid will display the same 15 rows (plus possibly an AddNew row). If you then (outside of the grid) add an additional row to this DataTable, the grid should automatically display it. So, if you want to see the grid add one row at the time, then you should add one row at the time to the DataTable that you have set as the grid''s DataSource. If you will explain more about what you want to do, maybe I can suggest something else.

David Bosak
Replied On December 9, 2004 11:42 PM UTC

Dear Clay, I suppose that I have 1000 rows in a datatable, I don''t want to use the command below to fill 1000 rows: grid1.DataSource = datatable1; At a time, I only want to read one row from datatable1, then fill this row to GridDataBoundGrid (use for()-loop). I have to use this way because I am creating a progress bar. Please help! D.B

Administrator [Syncfusion]
Replied On December 9, 2004 11:51 PM UTC

This is the only way you can set data into a GridDataBoudGrid. grid1.DataSource = datatable1; Once you do this, you could loop 1-1000 and add a DataRow at the to datatable1. Then this would make the rows appear one at the time in the grid. But they get added to the datatable, not to the grid. If you want to simulate adding rows to teh grid, you can handle the grid.Model.QueryRowCount event. In the event, set e.Count = this.MyRowCount;. In formLoad, set this.MyRowCount = 1 (or whatever number of rows you want to see in the grid initially.) After setting MyRowCount, make sure you call grid.Model.ResetVolatileData. Then in teh loop where you want to start showing more rows, increment MyRowCount, and call grid.Model.ResetVolatiledata.

David Bosak
Replied On December 10, 2004 12:30 AM UTC

Do you have any application sample for this?

Administrator [Syncfusion]
Replied On December 10, 2004 07:38 AM UTC

http://64.78.18.34/forums/Uploads/AddRows12092004.zip You would probably not want to do this in a tight loop as it will lock out all other processing on your UI thread while you are looping to display a row at the time. I am not sure what your needs are, but you could have a timer raise an event every so often, and display a row at that point. Or you could use something else to avoid locking up your UI as you put the rows up. If you try to do this from some other thread, then you will need to make sure all the interaction with the grid is done on the thread that created it (using grid.InvokeRquired checks).

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

;