Greetings, The problem is basically the same as in the Help file only I need to make the dataSet programmatically. It works when the dataAdapter is amde with the designer, but not programmatically and I ahve seen this code (similar) shown repeatedly as the solution. Code:
ds = new DataSet("CustOrders"); ultraGrid1.DataSource = null; OleDbDataAdapter daCust = new OleDbDataAdapter("select * from customers", conn); OleDbDataAdapter daOrders = new OleDbDataAdapter("select * from orders", conn); daCust.Fill(ds, "Customers"); daOrders.Fill(ds, "Orders"); ds.Relations.Add("CustomerOrders", ds.Tables["Customers"].Columns["CustomerID"], ds.Tables["Orders"].Columns["CustomerID"]); ultraGrid1.DataSource = ds; ultraGrid1.DataBind();I set the MaxBandDepth = 5 for performance. The ViewStyle is MultiBand. Both tables show in the data DataSet. The Grid just never displays the data. I get the same result when using the code directly from the sample page at WinGrid_Binding_to_Program_Generated_Hierarchical_Data.html that makes it's own tables.
Thanks much for the help, Mike
Are you creating the grid in code, too? If so, you need to add the grid to the Controls collection of the form for two reasons:
1) It needs a BindingContext
2) If you don't, then the grid will never be disposed (unless you dispose it in code).
No, I added the ultraGrid with the designer. Looking at the designer code, I see that quite a lot has been added. I put the tables together in a DataSet with a DataSet.Relation the relation defined. The data viewer in the debugger showed that the data for both tables was there.
Really, I thought I put in basically the exact code I found in
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1665 only I used existing tables.
I'd really apprecaite any help you can give me on this...
I was thinking of programmatically making two data tables, putting dataAdapters to them with DataSets and binding to them to show the ultraGrid what to expect, then I could populate both tables from the DB and bind to the ultraGrid. ... I dunno. It didn't look sensible, but I can't get it working.
Thanks for any help, Mike
You've completely lost me.
The grid doesn't know if you got your DataTable or DataSet from a DataBase or created it in code, nor does it care. That can't possibly have any effect - unless of course it's having some effect on the DataTable itself - but I can't imagine what that would be that would cause the grid not to display anything.
Also, you didn't answer my question about whether the grid shows nothing at all or if it only shows the columns and no rows.
The sample code you posted here isn't really any help, because I can't run it, which is why I asked for a sample project. Of course, I understand that you probably can't create a sample that accesses your real data, but you could use something like Northwind and then I could just change the connection string to point to the right place.
To the best of my knowledge/testing, it clearly does matter though. One works, the other doesn't.
No, it does not show the columns or column headers at all.
I do have some good test project code, I just have to figure out how to attach the zipped file. Cool, that looks like it. (Nice web capability) It is a form that can send the data from either a Northwind Db or tables it creates programmatically. I hope that helps.
T'anks, Mike
You just included a cs file here without any project or solution file, so I can't really run this. Can you post a completely solution?
I'm getting a litle crushed here, but I will post it ASAP.
Thanks
Greetings,
After recreating the project, I have come to think that the problem had to do with how I had the data in Visual Studio. If the data is "added" to Visual Studio correctly, the DataGrid works fine.
I'll attach a dandy little project with it.
T'anks (as us diver types say), Mike
... Crud, Can't attach much of a project even zipped up, in only 200K, but I attached all the forms. You can build the project from those in about 5 minutes and run it if you have a NorthWind Db. It will even run some without one.