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
580
UltraGrid - Stop loading navigationproperties
posted

Hello!

I use Entity Framwork 4.1 / MS SQL Server 2008

When 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

Parents
  • 469350
    Verified Answer
    Offline posted

    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.

Reply Children
No Data