Link to home
Start Free TrialLog in
Avatar of ITHelper80
ITHelper80

asked on

Move values from Datatable to Gridview columns based on values

I have a datatable with the following
ORID DATE TYPE HOURS WKDATE PUDATE PUINOUT PUTIME PUINOUT1 PUTIME1
79159 05/16/2009 OT 8.00 20090516 20090516 I 443 O 1322
79159 05/18/2009 WH 8.00 20090518 20090518 I 638 O 1522
79159 05/19/2009 WH 8.00 20090519 20090519 I 643 O 1528
79159 05/20/2009 OT 2.20 20090520 20090520 I 446 O 1530
79159 05/20/2009 WH 8.00 20090520 20090520 I 446 O 1530

My Gridview has  Date, In,Out, Overtime, etc

How can I place the Hours value into my Overtime Column when Type = OT?
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of satheeshm
satheeshm

I guess, you want to show hours in overtime column of datagrid, in that case you can use row databound event

if e.row.rowtype = datarow{
if e.row["Type"] == "OT"{
e.row["type"] = e.row["hours"]
}
}
Avatar of ITHelper80

ASKER

THank ged...Im going to try your solution first since you posted first.

Ive got one question, how can I bind the value of the reader to my columns?
Ive tried this but get an error about a readonly property.
 AS400DT.Columns("Overtime") = readerobjrs7.Item("Hours").ToString
I was able to figure out how to bind the rows with a reader. Thanks for the suggestions.