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
220
Cell Value always false?
posted

Hi,

the cell value in an pragramatically created Cell of type boolean is always false, even, if the grafically shown value is true.

this is the creation code (bold marked cells ar programmatically added, the other columns are initialized by DataSource:

        private void ultraTreeRequirements_ColumnSetGenerated(object sender, ColumnSetGeneratedEventArgs e)
        {
            switch (e.ColumnSet.Key)
            {
                case " ":
                    e.ColumnSet.Columns["ID"].Visible = false;
                    break;
                case "RequirementsList":
                    // e.ColumnSet.Columns["ID"].Visible = false;
                    e.ColumnSet.Columns["hardwareName"].Visible = false;
                    e.ColumnSet.Columns["GroupType_ID"].Visible = false;
                    e.ColumnSet.Columns["Type_ID"].Visible = false;
                    e.ColumnSet.Columns["ECU_Requirement_Items"].Visible = false;
                    e.ColumnSet.Columns["ECU_Deliverys"].Visible = false;
                    e.ColumnSet.Columns.Add("Check").DataType = typeof(bool);
                    e.ColumnSet.Columns["Check"].AllowCellEdit = AllowCellEdit.Full;

                    e.ColumnSet.Columns["datumLieferdatum"].Visible = false;
                    e.ColumnSet.Columns["datumStichtag"].Visible = false;
                    e.ColumnSet.Columns["Owner"].Visible = false;
                    break;
                case "":
                case "ChildWorkpiecesGroupList":
...

                  break;
            }
        }

Now i try to read the cell value as follows:

        private void ultraTreeRequirements_CellValueChanged(object sender, CellValueChangedEventArgs e)
        {
            if ((!e.Node.IsBandNode) && (e.Node.BandName == "RequirementsList") && (e.Cell.Column.Key == "Check"))
            {
                bool cellValue = (bool)e.Cell.Value;
                return;
            }
        }       

Even, if the shown value at the GUI is true, the readed value by code in cellValue is always false. What is my Problem?

 

Thanks and Greatings: Rudy

  • 69832
    Offline posted

    Use the CurrentValue property of the CellValueChangedEventArgs class. Note that you must check the IsValid property (same class) before accessing it because if the value is invalid an exception will be thrown.