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
105
No displaylayout after assigning datasource
posted

Hi all!

I wrote a usercontrol that contains a Tabcontrol. I need to dynamically add tabs and nested grids in the according tabpagecontrols. I managed to do that, but i have the problem to retrieve or alter the displaylayout settings after the datasource was assigned to the grid. If I do not try to manke changes to the displaylayout in the usercontrol and the control is shown on the form it works fine, but i need to change displaylayout settings. Where is the error in code, means, when can i set the displaylayout setting?

 

--code:

//Getting Data for tabs

            DST = Connect.GetDataSet(strSQLQuery);

 

            //clearing all tabs

            this.ultraTabControl1.Tabs.Clear();

            GridsToFormat = new Infragistics.Win.UltraWinGrid.UltraGrid[DST.Tables[0].Rows.Count];

            int i = 0;

 

            //Create Tab for each row

            foreach (System.Data.DataRow Rwo in DST.Tables[0].Rows)

            {

                Infragistics.Win.UltraWinTabControl.UltraTab Tab = new Infragistics.Win.UltraWinTabControl.UltraTab();

 

                Infragistics.Win.UltraWinGrid.UltraGrid StockGrid = new Infragistics.Win.UltraWinGrid.UltraGrid();

                Infragistics.Win.UltraWinTabControl.UltraTabPageControl TabPageControl = new Infragistics.Win.UltraWinTabControl.UltraTabPageControl();

 

                ((System.ComponentModel.ISupportInitialize)(StockGrid)).BeginInit();

                ((System.ComponentModel.ISupportInitialize)(this.ultraTabControl1)).BeginInit();

                this.ultraTabControl1.SuspendLayout();

                TabPageControl.SuspendLayout();

                this.SuspendLayout();

 

 

                this.ultraTabControl1.Controls.Add(TabPageControl);

                Tab.TabPage = TabPageControl;

                Tab.Key = System.Convert.ToString(Rwo["MST_Bezeichnung"]);

                Tab.Text = System.Convert.ToString(Rwo["MST_Bezeichnung"]);

                this.ultraTabControl1.Tabs.Add(Tab);

 

                TabPageControl.Controls.Add(StockGrid);

                this.intMedikament_ID = System.Convert.ToInt32(Rwo["LAG_Medicament_ID"]);

 

                TabPageControl.Controls.Add(this.grdDosageHistory);

                TabPageControl.Location = new System.Drawing.Point(1, 23);

                TabPageControl.Name = "ultraTabPageControl1";

                TabPageControl.Size = new System.Drawing.Size(389, 327);

                TabPageControl.Controls[0].Dock = DockStyle.Fill;

 

                ((System.ComponentModel.ISupportInitialize)(StockGrid)).EndInit();

                ((System.ComponentModel.ISupportInitialize)(this.ultraTabControl1)).EndInit();

                this.ultraTabControl1.ResumeLayout(false);

                TabPageControl.ResumeLayout(false);

 

                this.ResumeLayout(false);

 

                //Fetching Dataset for Grid and assign datasource

                FillValues(StockGrid);

 

                //Formatting the grid - here the error occurs (Displaylayout is null)

                FormatGrid(StockGrid);

 

                if (Convert.ToInt32(Rwo["LAG_Medicament_ID"]) == this.intActiveMedikamentID)

                {

                    this._ActiveStockGrid = StockGrid;

                }

                GridsToFormat[i] = StockGrid;

                i++;

            }

 

Please suggest, what i can do... Leaving out the funtion (FormatGrid(...) works, but displaylayout looks ugly...

 

Thank, Marc!

Parents Reply Children
No Data