Hello!I use Entity Framwork 4.1 / MS SQL Server 2008When i use the following code with the normal DataGridView, i see 1 SQL-Statement in the SQL-Server-Profiler. But when i use a UltraGrid it needs 5 SQL-Statements!private void Form1_Load(object sender, EventArgs e){ Entities context = new Entities(); this.ArtikelBindingSource.DataSource = context.WMS_Artikel.Execute(System.Data.Objects.MergeOption.AppendOnly);
// DataGridView: (Execute 1 SQL Command / SQL Server Profiler) this.DataGridView.DataSource = this.wMS_ArtikelBindingSource;
// UltraGrid: (Execute 5 SQL Commands / SQL Server Profiler) this.ultraGrid1.DisplayLayout.Bands[0].Indentation = 0; this.ultraGrid1.DisplayLayout.ViewStyle = Infragistics.Win.UltraWinGrid.ViewStyle.SingleBand; this.ultraGrid1.DataSource = this.wMS_ArtikelBindingSource;}
The UltraGrid load all Navigationsproperties (like OrderDetails ...) too.How can i stop this?Thanks 4 Help!myGil
You have understood me - and your Tip MaxBandDepth works fine for me!When i use Datasource at Designtime i must set MaxBandDepth=1 at Designtime.When i use Datasource at Runtime i must set MaxBandDepth=1 bevore i set the Datasource!Thanks 4 your Answer!
Hi,
The WinGrid does not generate any SQL statements, so I'm not sure I understand exactly what you mean.
WinGrid displays hierarchical data, of course, whereas the DataGridView does not. So maybe you are saying that the grid is accessing the child bands on your data source and you don't want that?
If that's the case, just set grid.DisplayLayout.ViewStyleBand to Single. You may also want to set MaxBandDepth on the grid to 1.