The situation is the wingrid has so many rows, about 1500 rows. I think it's not convinent for users. So I want to make the wingrid display in several pages, but I can't find some properties to do this thing.
Do I need to write code to so or I didn't find the property for paging display ?
Thank you!
WinGrid does not have any paging support.
It does support loading data on-demand using the UltraDataSource component. Check out the sample included with NetAdvantage - there's a sampleof displaying a million rows in a grid using this technique. I beleive the sample exists both in the WinGrid Samples Explorer and also as a separate sample under UltraDataSource.
OK... I saw the sample, it was very impressive.
But, I have not much idea how I can implement it with vb.net.
Where can I find the sample codes of it?
Thank you.
I found and saw the sample code, however, it did not help me much to do my task.
I have a dataset which have one datatable with lots and lots of datarows. (And it keeps increasing)
Dim dt as datatable = ds.Tables(0)
Instead of connecting this datatable directly to ultraGrid1 like
ultraGrid1.DataSource = dt
I'd like first put all those dataRows into UltraDataSource1, then I'd like to connect these two like
ultraGrid1.DataSource = UltraDataSource1
My question is how can I put all those datarows into UltraDataSource1?
Hi,
Copying all of the rows into an UltraDataSource would not help you with any sort of paging or loading on demand. This would be less efficient than just binding the grid to the data source.
The LoadOnDemand functionality uses the UltraDataSource as an intermediary between the grid and the "real" data source. What you do is handle events on the UltraDataSource that request data and populate the UltraDataSource cells on the fly as data is requested.
The Million Rows Sample demonstrates this by just using numeric values in place of a real data source.
OK... I've got it worked. Now when I scroll down the UltraGrid, every 1000 rows it triggers go to DB and
get another new 1000 rows.
Now, I'd like make the UltraGrid scrollable to anywhere in the grid without that triggering.
The triggering happens only when I am done with scrolling.
Is there any way to override UltraDataSource_CellDataRequested while scrolling and make it is called only when I release the scroll bar?
I switched between Deffered and Immediate of Scroll Style of UltraGrid, however, both of them triggered the UltraDataSource_CellDataRequested while scrolling.
No, there's no way to do that. I assume you are setting the row count on the UltraDataSource, so the grid's scrollbar should correctly represent the number of rows. CellDataRequested fires any time the grid requests data, and there's no way to stop the grid from requesting data for rows it needs as you scroll.
If you set ScrollStyle to Deffered, there may still be other reasons why the grid needs to access the rows, such as tooltips.
It's been a while since I worked with this, but I don't think you should be settng the count on the child collection at the same time you set the parent collection. Doesn't the event fire for each collection individually?
I'm not sure why you would want to do that, anyway. The point of setting the count is so that the scrollbar adjusts properly. But the scrollbar doesn't need to account for child rows until after a parent row is expanded.
I set the grid have parentBand and childBand. I have
Sub UltraDataSource1_InitializeRowsCollection(...)
If "ChildBand1" Is e.Rows.Band.Key Then
m_childCount = GetTotalRowNum(e.Rows.ParentRow.Tag)
e.Rows.SetCount(m_childCount)
End if
End Sub
Which is working very well for all the parentRows except the parentRow of index = 0. (The 1st Row)
I found the UltraDataSource1_InitializeRowsCollection sub is called and the childBand case is implemented when the ParentRows are created which I do not understand. Of course, since the ParentRows(0) is not created and the childBand of that wanted the e.Rows.ParentRow.Tag which is DBNull, it errored at that point. Therefore, the childBand's setCount as 0. And I cannot expand the 1st ParentRow to see the childBand Rows.
Is this a bug? Otherwise, is there any way to make the 1st ParentRow expandable to display its child Rows?