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
640
UltraGrid Checkbox
posted

Hi Everyone

I am using an UltraGrid in which one of the column style must be Checkbox.

I have created the Checkbox but when passing the data from the database as a datasource it makes all the CheckBoxes checked. I ll have two values in the database Y or N if it is Y the checkbox should be check if N it should be unchecked.

Could someone help me in this issue

Thanks in advance

Ferdin

Parents
  • 735
    posted

    I would strongly suggest that you change the data type of your column in the database to boolean/bit. Storing it as a string is inefficient and causes the problem you experience because when the column value is evaluated to true/false it will treat 0 as false and anything else as 1/true, and technically each character is represented by an integer (ASCII) value. In ASCII the letter N=78 and Y=89, so when the cell trieds to convert the value to a boolean, it will always return true.

    Your other option is that you manually set the checkbox value for each row in the InitializeRow event by checking if the value is N or Y. There might be a way to map N to false and Y to true for the grid column so that it happends automatically, but I am not sure. I really recommend that you change the column type in your database. The data in the database should always be stored in the most efficient way possible and not in a way that makes it easily readable for a person.

Reply Children
No Data