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
105
datachanged property of editable cell.
posted

hello all,

i am using ultrawingrid. i have a an editable column in the grid. its a comment field. i would like to know what is the difference between cell.value and cell.text?

after editing the contents of the cell, i save it to the database. after i save, i still find that cell.value = old value and cell.text is current text.

i want cell.value and cell.text to point to current comment.

Also, is there a way to check if contents of the cell have been updated or not. i tried using datachanged property but this is property gets set to true even if we undo our changes..

 i hope i mentioned the issue clrealy.

thank u

jalsa

Parents
  • 469350
    Offline posted

     Hi Jalsa,

        Text is what the user sees on the screen. Value is the value from the underlying data source.

        To understand why this is the case, consider an example of a DateTime cell in the grid. If the user types a single character into this cell, like the number 1, then this is not a valid DateTime. So you would not want the grid to try to update the value of the underlying table with an invalid date and raise an exception. So the 1 is assigned to the Text property of the cell and the Value is not updated.

        The underlying Value of the data source is updated based on the UpdateMode property. By default, it is updated when the user leaves the cell or the grid loses focus. My guess is that you probably have a Save button in your application on a toolbar or some other control that does not take focus. Since a toolbar button does not take focus, the grid does not lose focus, and the Value of the current cell in edit mode is not updated. So what you need to do is force the grid to commit any pending changes before you save. You can do this by calling the UpdateData method on the grid (to update all rows in the grid) or the Update method on the ActiveRow to update just the one row). 

         

Reply Children
No Data