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
395
Compare column values in two datatables
posted

Hello,

I have two datatables dt1 and dt2. They are in different datasources ds1 and ds2,

Structure of dt1 and dt2 is

Question_ID,Value

I want to build ultragrid which is as follows:-

Question_ID ,Value from dt1,Value from dt2

and I want to highlight mark all rows for which Value from dt1 and value from dt2 are not same for Question_ID.

Is there any easy way of doing this rather than comparing datasets,finding differences etc?

Thank you,

 

Parents
No Data
Reply
  • 17259
    Verified Answer
    Offline posted

    To populate the grid, make a join between the two tables, most easy with linq.

    For the highlight, handle the InitializeRow event:

    if (!e.Row.GetCellValue(dt1_Value).Equals(e.Row.GetCellValue(dt2_Value))

    e.Row.Appearance.BackColor ...

Children