How to change gridview cell value on the basis of condition RRS feed

  • Question

  • User-367318540 posted

    I have gridview in which INTIME ,OUTTIME ,HOurs and Day column are available and i am directly inserting value from gridview into database.

    2018-05-26 09:22am 2018-05-26 10:22pm 11 1
    2018-05-26 09:22am 0 0 0
    2018-05-26 10:22pm 0 0

    Now i want on update button click Hours and Day value must be equal to 0, if INTIME or OUTIME does not excit in gridview cell .please guide

    Tuesday, January 1, 2019 2:04 AM

All replies

  • User475983607 posted

    The current design breaks normalization rules. The Hours and Day values can be calculated from the IN and OUT column on request.  There is no need to have Hour and Day columns in the table.  This will simplify the code and there will be less chance of data bugs.

    Tuesday, January 1, 2019 3:10 PM
  • User-1716253493 posted

    Like another said, you don't need to save the result manualy, use calculated field or direct query.

    To replace null result for null in/out value use ISNULL() function

    ISNULL(a-b,0) as total

    Tuesday, January 1, 2019 3:39 PM
  • User-1174608757 posted

    Hi akhterr

     According to your description,I couldn't understand your requirements clearly.Is INTIME OUTTIME  from a table in database or else?

    Do you want to change the value of cells or want to change data in Database?So,could  you please post more  details about your code?

    It will help us  to solve your problem quickly.

    Best Regards

    Wei Zhang

    Wednesday, January 2, 2019 6:19 AM