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,
The join should be something like that:
var rows = from row1 in dt1.AsEnumerable() join row2 in dt2.AsEnumerable() on row1["Question_ID"] equals row2["Question_ID"] select new { Question_ID = row1["Question_ID"], Value1 = row1["Value1"], Value2 = row2["Value2"] };grid.DataSource = rows.ToArray();
Hi Amiram.
Thank you very much, It was helpful !
Hi Amiram,
Thank you for the response.
How do I join when tables are in different datasources? Can you please provide the snippet?
I truely appreciate the help.
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 ...