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
500
WinGrid - Load/Save layout
posted

Hello

I got some questions to Load and Save WinGrid layouts, the behavior on getting over 50thousand lines of designer code when adding a bindingsource. The bindingsource look on a datasource table which has an 'inherited' parent/children relation on itself.

My first problem is the datatable in my datasource which has a recursiv character / parent/child relation. The designer file sometimes takes few minutes to load and has over 50.000 lines of code an nearly a thousand band inherited. I tried the property singleband and maxbanddepth to 1. But i am not shure if this was going to help or the fact that i deleted the table relation on itself in the dataset.

My second problem is about loading the display layout. I wanted to load the layout from a database depending which user is 'logged in'. For this behavior i got a usercontrol with a wingrid. The first 'standard' design comes from a lyt-file when no layout (or standard-layout)  could be found in the database. But sometimes columns which i made hidden are visible again and i don't know why.

Third problem is that after some changes the event 'AfterRowLayoutItemResized' didn't fire when i changed the size of a column-width or row-height. I wondered why know cause earlier it fires at this point. I tryed to delete the event and add it again but it still didn't work

And now a forth problem is that i could save the layout, but the layout won't load correctly. The column-width changes load correctly. But the Row-height changes won't load.

 

Thanks for your support.

Greetings from germany

 

Dietrich

 

Sample Code:

UserControl

private string user = GridExtensionClass.STANDARD_USER;

        public string User // this i how the usercontrol gets the userchange from the parent frame
        {
            get { return user; }
            set
            {
                user = value;
                GridExtensionClass.loadLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user);
                ultraGridWorkgroups.Refresh();
            }
        }

private void ultraGridWorkgroups_AfterRowResize(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
        {
            GridExtensionClass.saveLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user);
        }


        private void ultraGridWorkgroups_AfterColPosChanged(object sender, Infragistics.Win.UltraWinGrid.AfterColPosChangedEventArgs e)
        {
            GridExtensionClass.saveLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user);
        }
        private void ultraGridWorkgroups_AfterRowLayoutItemResized(object sender, Infragistics.Win.UltraWinGrid.AfterRowLayoutItemResizedEventArgs e) //doesn't work anymore, event won't fire on row size/header changes
        {
            GridExtensionClass.saveLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user);
        }

 

HelperFile:

public static void loadLayout(UltraGrid grid,
            ECU_UserLayoutsTableAdapter tableAdapter, string actualUser)
        {

            byte[] myData = (byte[])tableAdapter.ecu_loadLayout(actualUser, grid.Name);
            try
            {
                //grid.ResetLayouts(); //no changes on the row heights issue
                //grid.ResetDisplayLayout(); //no changes on the row heights issue
                grid.DisplayLayout.Load(new MemoryStream(myData));
            }
            catch (ArgumentNullException ane) //if no layout is found in the database
            {
                loadRessourcesLayout(grid,tableAdapter);
                //GridExtensionClass.saveLayout(grid, tableAdapter, "Standard");
            }
        }

 

Parents Reply Children