User (Old forums)MemberJanuary 3, 2008 at 10:18 pmPost count: 23064
Out of the blue the grid no longer binds correctly. Here is sample code:
.DataSource = dt
This code has worked fine for a while. Now all of the sudden my grid shows 0 datarows, however, if I set a breakpoint right after end init I see the datatable (dt) has rows, but the xceed grid datarows is empty.
What is even more strange is that I put a regular DataGridView on the form and bound to that right before the BeginInit of the xceed grid binding and for some reason that makes it work. I have no clue why binding to something else before binding to the xceed grid would make a difference but it does.
Any suggestions would be great.
Imported from legacy forums. Posted by jdanko (had 3187 views)Xceed SupportMemberJanuary 4, 2008 at 1:42 pmPost count: 5658
I tried pretty much the same code as you and it worked fine.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
.DataSource = GetTable()
Private Function GetTable() As DataTable
‘Create a DataTable
Dim dt As New DataTable()
Dim dcId As New DataColumn()
dcId.ColumnName = “ComplexId”
dcId.DataType = System.Type.[GetType](“System.Int64”)
Dim dcName As New DataColumn()
dcName.ColumnName = “ComplexName”
dcName.DataType = System.Type.[GetType](“System.String”)
For i As Integer = 0 To 49
Dim row As System.Data.DataRow = dt.NewRow()
row(“ComplexId”) = i
row(“ComplexName”) = i.ToString() + “%”
Imported from legacy forums. Posted by CharlesB (had 184 views)User (Old forums)MemberJanuary 4, 2008 at 3:13 pmPost count: 23064
Yes, well I can make a simple app like that and it works. For some reason with all of the code I have something makes it not work. I was wondering if you had any ideas. I can make it work perfectly fine if i add the following line of code:
dt = GetTable()
DataGridView1.DataSource = dt
.DataSource = dt
For some reason binding it to a datagridview before binding it to the xceed grid does something to the datatable or some action that resolves the problem. Is there anything that might need changed on my datatable?
Imported from legacy forums. Posted by jdanko (had 396 views)Xceed SupportMemberJanuary 8, 2008 at 12:02 pmPost count: 5658
The issue could be related to the DataMember not being explicitly set at this point.
Instead of using the DataSource property to set the source, you could use the SetDataBinding method. It will directly set both the DataSource and the DataMember.
Imported from legacy forums. Posted by CharlesB (had 4042 views)
- You must be logged in to reply to this topic.