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
245
DropDownList do not show data in WinGrid
posted

Hi, I've added dropdownlist in UltraWinGrid using following code. But for some reason I can't see any data even when I click "drop down list".

After much struggle I could set the value using second code snippet, but still the clicking on drop down do not show any other data that I've added. 

Note that the demo code I've have do show data fine. Not sure how to fix this.

Thanks

Code snippet # 1

            if (!e.Layout.Bands[0].Columns.Exists("PACKAGE"))

            {

                e.Layout.Bands[0].Columns.Add("PACKAGE", "UNIT");

                e.Layout.Bands[0].Columns["PACKAGE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;

                e.Layout.Bands[0].Columns["PACKAGE"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;

                e.Layout.Bands[0].Columns["PACKAGE"].DataType = typeof(System.String);

                e.Layout.Bands[0].Columns["PACKAGE"].Hidden = false;

                e.Layout.Bands[0].Columns["PACKAGE"].Width = 10;

            }

            if (!this.twGrid_SIG.DisplayLayout.ValueLists.Exists("PACKAGE_LIST"))
            {
                this.twGrid_SIG.DisplayLayout.ValueLists.Add("PACKAGE_LIST");
            }
            List<string> units = LoadPackageSelector();
            this.twGrid_SIG.DisplayLayout.ValueLists["PACKAGE_LIST"].ValueListItems.Clear();
            foreach (string str in units)
            {
                this.twGrid_SIG.DisplayLayout.ValueLists["PACKAGE_LIST"].ValueListItems.Add(str.Trim());
            }
            e.Layout.Bands[0].Columns["PACKAGE"].ValueList = this.twGrid_SIG.DisplayLayout.ValueLists["PACKAGE_LIST"]; 
Code Snippet#2
            foreach (UltraGridRow ugr in this.twGrid_SIG.Rows)
            {
                //int index = -1;
                Infragistics.Win.ValueList vl = this.twGrid_SIG.DisplayLayout.ValueLists["PACKAGE_LIST"];
                ugr.Cells["PACKAGE"].ValueList = vl;
                ugr.Cells["PACKAGE"].Value = ugr.Cells["PACKAGE"].ValueList.GetText(1);
            }