Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Grid.Rows.Count = 46, Datasource.Count = 46, Rows not showing in UI
posted

Hello,

I have a UltraWinGrid and a BindingSource object.  During run time I create a list of my Facility class and bind the BindingSource to the list.  Then I bind the UltraWinGrid to the BindingSource.

 

    Private Sub SelectAllButton_Click(sender As System.Object, e As System.EventArgs) Handles SelectAllButton.Click
        If FacilityBrowse.ReturnControl.GetType Is GetType(UltraGrid) Then
            Dim fac as frmFacilities = frmFacilities
            Dim list As New List(Of ISMSLib.Facility)
                For Each row As UltraGridRow In ResultsGrid.Rows
                    list.Add(New ISMSLib.Facility With {.ID = row.Cells(0).Value, .Abbreviation = row.Cells(1).Value, .FCL = row.Cells(2).Value})
                Next
            End With
            fac.FacilityBindingSource.DataSource = list
        End If
        Me.Close()
    End Sub

Here is after I leave that method:

 

        ctrFacBrowse.ShowDialog()

        If FacilityBindingSource.Count > 0 Then

            RecordsGrid.DataSource = FacilityBindingSource

            RecordsGrid.Text = "Facilities (" & RecordsGrid.Rows.Count & " Records)"

        End If

 

When I leave this method and go back to frmFacilities, the count for both the DataSource and Grid.Rows is 46.  But nothing shows.  Nowhere else am I "over riding" the datasource...in fact when I go back to "browse" again...the immediate window stills says I have 46 rows in the grid.

Also the default Grid.Text (Header Text) is "Facilities (0 Records)" and after the records are bound in memory the text is updated to "Facilities (46 Records" but that does not "update" on the gird either...just in memory in the immediate window everything (header text, row count) shows correct.

Just not displaying.

EDIT:

RecordsGrid_InitializeRow(sender As Object, e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles RecordsGrid.InitializeRow

Is firing 46 times....so I know the rows are being added...

Edit 2:

Added .BeginUpdate and .EndUpdate around setting the grid datasource, then perform a .Refresh, still does not "paint" the grid.

Any ideas?  Thank you for your help.

 

 

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    If your grid.Rows.Count is returning 46 and the grid isn't displaying any rows, then there are only a few possibilities.

    1) All of the rows are hidden. Try looping through the grid rows or just examining the first row in the rows collection and check the HiddenResolved property. If the rows are hidden, it could be because you set Hidden to true or it could be because there is filtering applied to the grid.

    2) You are looking at the wrong grid.

    3) You are using a DrawFilter or a CreationFilter on your grid to remove the UIElements for the cells and the rows.

    4) You have rows, but no columns. This doesn't seem to be the case. It's hard to tell from this screen shot, but I am guess that the grid is on the right and I can see some column headers for Abbreviation and Clearance.

    If none of that helps, then see if you can post a small sample project demonstrating the issue and i will be happy to check it out and tell you what's wrong.

Children