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
579
Adding a "Selected" Column
posted

Hi,

 

I use your WinGrid (2008 vol 3) in my project.

First I make a control ctlTaskDataGrid that inherits from the WinGrid control.

There I add all columns dynamicly at runtime. Then I add a Column "Selected" (DataType: Boolean).

I want to use this column to let the user select multiple rows without having to use SHIFT or CTRL. Only the problem is that all columns must be readonly (they are bounded columns and I don't want the user to make be allowed to make any changes on those records) EXCEPT the "Selected" column in which the user must be able to check or uncheck the value.

This is how I thought it must be done:

 //Insert Select-Column
            this.DisplayLayout.Bands[0].Columns.Add("Selected", "S");
            this.DisplayLayout.Bands[0].Columns["Selected"].DataType = Type.GetType("System.Boolean");
            this.DisplayLayout.Bands[0].Columns["Selected"].CellActivation = Activation.AllowEdit;

 

 //For each Column in the Dynamics NAV Table
            foreach (clsColumn col in table.Columns)
            {
                //If the Column is set to visible
                if (col.Visible)
                {

                    //Add the Column To the UltraGrid with ***ated .NET DataTupe, Name, Header Caption..
                    this.DisplayLayout.Bands[0].Columns.Add(col.ColumnNameNav, columnDisplay);
                    this.DisplayLayout.Bands[0].Columns[col.ColumnNameNav].DataType = col.GetNetType();
                    this.DisplayLayout.Bands[0].Columns[col.ColumnNameNav].CellActivation = Activation.NoEdit;
                    this.DisplayLayout.Bands[0].Columns[col.ColumnNameNav].Nullable = Infragistics.Win.UltraWinGrid.Nullable.Nothing;

                    //Set the Display Date/Time according to XML Config File Format Values
                    if (col.NavDataTypeEnum == NavDataType.Date)
                        this.DisplayLayout.Bands[0].Columns[col.ColumnNameNav].Format = clsApplication.appSettings.GetDateFormat();
                    if (col.NavDataTypeEnum == NavDataType.Time)
                        this.DisplayLayout.Bands[0].Columns[col.ColumnNameNav].Format = clsApplication.appSettings.GetTimeFormat();

                    //Set the Tag property of the UltraGrid Column to the Dynamics NAV Column Information
                    this.DisplayLayout.Bands[0].Columns[col.ColumnNameNav].Tag = col;

                    //Set Options to text instead of integers
                    if (col.NavDataTypeEnum == NavDataType.Option)
                    {
                        this.DisplayLayout.ValueLists.Add(col.ColumnNameNav);
                        int index = 0;
                        foreach (string item in col.GetOptions())
                        {
                            this.DisplayLayout.ValueLists[col.ColumnNameNav].ValueListItems.Add(index, item);
                            index++;
                        }
                        this.DisplayLayout.Bands[0].Columns[col.ColumnNameNav].ValueList = this.DisplayLayout.ValueLists[col.ColumnNameNav];
                    }

                    //Set the Column Sorting to None
                    clsSortColumn SortCol = new clsSortColumn(col.ColumnNameNav, col, SortIndicator.None, -1);
                    SortColumns.Add(SortCol);

                }

            }

 

But this doens't work.

The result should look like this: ("S" = Selected Column)

Parents Reply Children
No Data