FlexGridClassic cell text changed to maximum value automatically

Posted by: salams on 7 February 2018, 6:07 pm EST

    • Post Options:
    • Link

    Posted 7 February 2018, 6:07 pm EST

    hi,

    i am using FlexGridClassic with binding from database , the cell text changed to maximum typeof cell type when i enter a large value bigger than the maximum with out notify .

    for example :

    if the column is Int32 and when i write inside the cell 2147499999 it will be changed automatically to 2147483647 .

    Is there any way to get error message before the automatic change?and to disable the automatic change?

    what i need is for example : if the cell text is 214748364 and i add to it the number 9 i will get error message and the cell text will still be 214748364 and not 2147483647 .

    Thanks,

    Salam S.

  • Posted 8 February 2018, 7:43 pm EST

    Hi Salam!

    In this scenario, you can assign TextBox to Editor of the Int32 type column, and achieve the desired behaviour. Please see the attached sample as workaround.

    Prj_MaxIntegerInCell.zip

    Best regards,

    Meenakshi

  • Posted 10 February 2018, 9:04 pm EST

    thanks for the answer

    i look at the workaround and i still need to get the last good value.

    for example if the cell text is “99” and i write “1234r” i will get the error message and the cell text will be “1234” with out the “r” and not also the old value “99”

    thanks again

  • Posted 10 February 2018, 9:07 pm EST

    i solved it by get the column type and then i resolve the max and min value and check it

    it work but i cant set the cell value , i always be the max value

    what i did is this:

    var ColType = c1FlexGridClassic2.get_ColDataType(grid.Col);

                    var MaxValue = (ColType.GetField("MaxValue") as FieldInfo).GetValue(null);
                    var MinValue = (ColType.GetField("MinValue") as FieldInfo).GetValue(null);
    
                    BigInteger BigMaxValue = BigInteger.Parse(Convert.ToString(MaxValue));
                    BigInteger BigMinValue = BigInteger.Parse(Convert.ToString(MinValue));
    
                    BigInteger BigNewValue = BigInteger.Parse(Convert.ToString(grid.Value + digit));
    
                    if (!(BigNewValue <= BigMaxValue && BigNewValue >= BigMinValue))
                    {
    

    MessageBox.Show(string.Format(“Illegal Value for {0}”, c1FlexGridClassic2.ColumnCollection[grid.Col].Name));

    }

  • Posted 11 February 2018, 6:47 pm EST

    the above solution not full working . i still need to get the last good value.

    for example if the cell text is “99” and i write “1234r” i will get the error message and the cell text will be “1234” with out the “r” and not also the old value “99”

  • Posted 11 February 2018, 8:57 pm EST

    Hi Salam!

    You can simply trim the last character of the text, and show the error message. I am modifying the previous sample and attaching it to this post, for your reference.

    Hope this helps.

    Prj_MaxIntegerInCell_Mod.zip

    Best regards,

    Meenakshi

  • Posted 21 February 2018, 2:32 am EST

    dungchuot7979@yahoo.com.vn

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels