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
605
Grid Schema Changing on binding Datasource
posted

Hello,

I have a ultra grid ,  for which I have defined a schema (Code Below)... and when I bind this grid with a data source,  which is basically a list of objects of a class which we have defined. 

Now this class has lot more properties that are not supposed to be displayed on the grid. But for some reason when bind them to this data source, extra columns which are nothing but properties in this calss. 

How do i prevent this from happening. I looked at this link.. and tried what is in there but was still not able to get over this issue. 

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=6702

 

Designer Code

-----------------------

 

  Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand3 = new Infragistics.Win.UltraWinGrid.UltraGridBand("BasketItemData", -1);

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn1 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Names", -1, null, 0, Infragistics.Win.UltraWinGrid.SortIndicator.Ascending, false);

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Types");

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Vintages");

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn4 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Unitss");

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn5 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Deleteds");

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn6 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("QuantityCss");

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn7 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("QuantityUs");

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn8 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Retails");

            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn9 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("RetailExts");

 

 

 

 this.dgMOSItemsGrid.DataMember = null;

            appearance10.BackColor = System.Drawing.SystemColors.Window;

            appearance10.BorderColor = System.Drawing.SystemColors.InactiveCaption;

            this.dgMOSItemsGrid.DisplayLayout.Appearance = appearance10;

            ultraGridColumn1.Header.VisiblePosition = 1;

            ultraGridColumn1.TabIndex = 1;

            ultraGridColumn1.Width = 96;

            ultraGridColumn2.Header.VisiblePosition = 2;

            ultraGridColumn2.TabIndex = 2;

            ultraGridColumn2.Width = 82;

            ultraGridColumn3.Header.VisiblePosition = 3;

            ultraGridColumn3.TabIndex = 3;

            ultraGridColumn3.Width = 75;

            ultraGridColumn4.Header.VisiblePosition = 4;

            ultraGridColumn4.Width = 61;

            ultraGridColumn5.Header.Caption = "Deletes";

            ultraGridColumn5.Header.VisiblePosition = 0;

            ultraGridColumn5.TabIndex = 0;

            ultraGridColumn5.Width = 46;

            ultraGridColumn6.Header.VisiblePosition = 5;

            ultraGridColumn6.Width = 80;

            ultraGridColumn7.Header.VisiblePosition = 6;

            ultraGridColumn7.Width = 111;

            ultraGridColumn8.Header.VisiblePosition = 7;

            ultraGridColumn9.Header.VisiblePosition = 8;

            ultraGridBand3.Columns.AddRange(new object[] {

            ultraGridColumn1,

            ultraGridColumn2,

            ultraGridColumn3,

            ultraGridColumn4,

            ultraGridColumn5,

            ultraGridColumn6,

            ultraGridColumn7,

            ultraGridColumn8,

            ultraGridColumn9});

            ultraGridBand3.RowLayoutStyle = Infragistics.Win.UltraWinGrid.RowLayoutStyle.ColumnLayout;

            this.dgMOSItemsGrid.DisplayLayout.BandsSerializer.Add(ultraGridBand3);

            this.dgMOSItemsGrid.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;

            appearance11.BackColor = System.Drawing.SystemColors.ActiveBorder;

            appearance11.BackColor2 = System.Drawing.SystemColors.ControlDark;

            appearance11.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;

            appearance11.BorderColor = System.Drawing.SystemColors.Window;

            this.dgMOSItemsGrid.DisplayLayout.GroupByBox.Appearance = appearance11;

            appearance12.ForeColor = System.Drawing.SystemColors.GrayText;

            this.dgMOSItemsGrid.DisplayLayout.GroupByBox.BandLabelAppearance = appearance12;

            this.dgMOSItemsGrid.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;

            appearance13.BackColor = System.Drawing.SystemColors.ControlLightLight;

            appearance13.BackColor2 = System.Drawing.SystemColors.Control;

            appearance13.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;

            appearance13.ForeColor = System.Drawing.SystemColors.GrayText;

            this.dgMOSItemsGrid.DisplayLayout.GroupByBox.PromptAppearance = appearance13;

            this.dgMOSItemsGrid.DisplayLayout.MaxColScrollRegions = 1;

            this.dgMOSItemsGrid.DisplayLayout.MaxRowScrollRegions = 1;

            appearance20.BackColor = System.Drawing.SystemColors.Window;

            appearance20.ForeColor = System.Drawing.SystemColors.ControlText;

            this.dgMOSItemsGrid.DisplayLayout.Override.ActiveCellAppearance = appearance20;

            appearance41.BackColor = System.Drawing.SystemColors.Highlight;

            appearance41.ForeColor = System.Drawing.SystemColors.HighlightText;

            this.dgMOSItemsGrid.DisplayLayout.Override.ActiveRowAppearance = appearance41;

            this.dgMOSItemsGrid.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Dotted;

            this.dgMOSItemsGrid.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;

            appearance42.BackColor = System.Drawing.SystemColors.Window;

            this.dgMOSItemsGrid.DisplayLayout.Override.CardAreaAppearance = appearance42;

            appearance43.BorderColor = System.Drawing.Color.Silver;

            appearance43.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;

            this.dgMOSItemsGrid.DisplayLayout.Override.CellAppearance = appearance43;

            this.dgMOSItemsGrid.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;

            this.dgMOSItemsGrid.DisplayLayout.Override.CellPadding = 0;

            appearance44.BackColor = System.Drawing.SystemColors.Control;

            appearance44.BackColor2 = System.Drawing.SystemColors.ControlDark;

            appearance44.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;

            appearance44.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;

            appearance44.BorderColor = System.Drawing.SystemColors.Window;

            this.dgMOSItemsGrid.DisplayLayout.Override.GroupByRowAppearance = appearance44;

            appearance46.TextHAlignAsString = "Left";

            this.dgMOSItemsGrid.DisplayLayout.Override.HeaderAppearance = appearance46;

            this.dgMOSItemsGrid.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;

            this.dgMOSItemsGrid.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.WindowsXPCommand;

            appearance51.BackColor = System.Drawing.SystemColors.Window;

            appearance51.BorderColor = System.Drawing.Color.Silver;

            this.dgMOSItemsGrid.DisplayLayout.Override.RowAppearance = appearance51;

            this.dgMOSItemsGrid.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;

            appearance52.BackColor = System.Drawing.SystemColors.ControlLight;

            this.dgMOSItemsGrid.DisplayLayout.Override.TemplateAddRowAppearance = appearance52;

            this.dgMOSItemsGrid.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;

            this.dgMOSItemsGrid.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;

            this.dgMOSItemsGrid.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;

            this.dgMOSItemsGrid.Location = new System.Drawing.Point(3, 152);

            this.dgMOSItemsGrid.Name = "dgMOSItemsGrid";

            this.dgMOSItemsGrid.Size = new System.Drawing.Size(800, 180);

            this.dgMOSItemsGrid.TabIndex = 134;

 

 

 

Parents
No Data
Reply
  • 469350
    Offline posted

    There are primarily two reasons why this doesn't work, and unfortunately, the code you provided here doesn't include the code that matters.

    • Do not set the DataSource or DataMember properties of the grid in code. Use the SetDataBinding method instead.
    • Make sure that the band names in your data source match up to the names of the bands in your actual data source. You appear to be using a single band here named BasketItemData. So if you are binding the grid to a DataTable at run-time, you must make sure that the TableName of the table you are binding to is "BasketItemData".
Children
No Data